Scalr\Service\Aws\Ec2\V20150415\Ec2Api::describeNetworkInterfaceAttribute PHP Method

describeNetworkInterfaceAttribute() public method

Describes a network interface attribute.You can specify only one attribute at a time.
public describeNetworkInterfaceAttribute ( string $networkInterfaceId, Scalr\Service\Aws\Ec2\DataType\NetworkInterfaceAttributeType $attribute ) : mixed
$networkInterfaceId string The ID of the network interface.
$attribute Scalr\Service\Aws\Ec2\DataType\NetworkInterfaceAttributeType The attribute.
return mixed Returns attribute value. It can be string, boolean, NetworkInterfaceAttachmentData or GroupList depends on attribute value you provided.
    public function describeNetworkInterfaceAttribute($networkInterfaceId, NetworkInterfaceAttributeType $attribute)
    {
        $result = null;
        $options = ['NetworkInterfaceId' => (string) $networkInterfaceId, 'Attribute' => (string) $attribute];
        $action = ucfirst(__FUNCTION__);
        $response = $this->client->call($action, $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            $response = null;
            $ptr = $sxml->{$options['Attribute']};
            $entity = $this->ec2->getEntityManagerEnabled() ? $this->ec2->networkInterface->get($options['NetworkInterfaceId']) : null;
            switch ($options['Attribute']) {
                case NetworkInterfaceAttributeType::ATTR_DESCRIPTION:
                    $result = (string) $ptr->value;
                    break;
                case NetworkInterfaceAttributeType::ATTR_SOURCE_DEST_CHECK:
                    $result = (string) $ptr->value == 'true';
                    break;
                case NetworkInterfaceAttributeType::ATTR_ATTACHMENT:
                    $result = $this->_loadNetworkInterfaceAttachmentData($ptr);
                    break;
                case NetworkInterfaceAttributeType::ATTR_GROUP_SET:
                    $result = $this->_loadGroupList($ptr);
                    break;
                default:
                    throw new \InvalidArgumentException(sprintf('Unexpected attribute "%s" in %s call', $options['Attribute'], $action));
            }
            if ($entity !== null) {
                $entity->{$options['Attribute']} = $result;
            }
        }
        return $result;
    }
Ec2Api