create_network_interface ( $subnet_id, $opt )

Access

public

Parameters

Parameter

Type

Required

Description

$subnet_id

string

Required

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • Description - string - Optional -
  • PrivateIpAddress - string - Optional -
  • SecurityGroupId - string|array - Optional - Pass a string for a single value, or an indexed array for multiple values.
  • PrivateIpAddresses - array - Optional -
    • x - array - Optional - This represents a simple array index.
      • PrivateIpAddress - string - Required -
      • Primary - boolean - Optional -
  • SecondaryPrivateIpAddressCount - integer - Optional -
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Create a new network interface.

$ec2 = new AmazonEC2();

$response = $ec2->create_network_interface($subnet_id);

var_dump($response->isOK());
Result:
bool(true)

Source

Method defined in services/ec2.class.php | Toggle source view (25 lines) | View on GitHub

public function create_network_interface($subnet_id, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['SubnetId'] = $subnet_id;
    
    // Optional list (non-map)
    if (isset($opt['SecurityGroupId']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'SecurityGroupId' => (is_array($opt['SecurityGroupId']) ? $opt['SecurityGroupId'] : array($opt['SecurityGroupId']))
        )));
        unset($opt['SecurityGroupId']);
    }
    
    // Optional list + map
    if (isset($opt['PrivateIpAddresses']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'PrivateIpAddresses' => $opt['PrivateIpAddresses']
        )));
        unset($opt['PrivateIpAddresses']);
    }

    return $this->authenticate('CreateNetworkInterface', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback