本文整理汇总了PHP中Amazon_EC2_Interface类的典型用法代码示例。如果您正苦于以下问题:PHP Amazon_EC2_Interface类的具体用法?PHP Amazon_EC2_Interface怎么用?PHP Amazon_EC2_Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Amazon_EC2_Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invokeStartInstances
/**
* Start Instances Action Sample
* Starts an instance that uses an Amazon EBS volume as its root device.
* Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started.
* When an instance is stopped, the compute resources are released and you are not billed for hourly
* instance usage. However, your root partition Amazon EBS volume remains, continues to persist your
* data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_StartInstances or array of parameters
*/
function invokeStartInstances(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->startInstances($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " StartInstancesResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetStartInstancesResult()) {
echo " StartInstancesResult\n";
$startInstancesResult = $response->getStartInstancesResult();
$startingInstancesList = $startInstancesResult->getStartingInstances();
foreach ($startingInstancesList as $startingInstances) {
echo " StartingInstances\n";
if ($startingInstances->isSetInstanceId()) {
echo " InstanceId\n";
echo " " . $startingInstances->getInstanceId() . "\n";
}
if ($startingInstances->isSetCurrentState()) {
echo " CurrentState\n";
$currentState = $startingInstances->getCurrentState();
if ($currentState->isSetCode()) {
echo " Code\n";
echo " " . $currentState->getCode() . "\n";
}
if ($currentState->isSetName()) {
echo " Name\n";
echo " " . $currentState->getName() . "\n";
}
}
if ($startingInstances->isSetPreviousState()) {
echo " PreviousState\n";
$previousState = $startingInstances->getPreviousState();
if ($previousState->isSetCode()) {
echo " Code\n";
echo " " . $previousState->getCode() . "\n";
}
if ($previousState->isSetName()) {
echo " Name\n";
echo " " . $previousState->getName() . "\n";
}
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例2: invokeDescribeReservedInstancesOfferings
/**
* Describe Reserved Instances Offerings Action Sample
* The DescribeReservedInstancesOfferings operation describes Reserved
* Instance offerings that are available for purchase. With Amazon EC2
* Reserved Instances, you purchase the right to launch Amazon EC2 instances
* for a period of time (without getting insufficient capacity errors) and
* pay a lower usage rate for the actual time used.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_DescribeReservedInstancesOfferings or array of parameters
*/
function invokeDescribeReservedInstancesOfferings(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->describeReservedInstancesOfferings($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " DescribeReservedInstancesOfferingsResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetDescribeReservedInstancesOfferingsResult()) {
echo " DescribeReservedInstancesOfferingsResult\n";
$describeReservedInstancesOfferingsResult = $response->getDescribeReservedInstancesOfferingsResult();
$reservedInstancesOfferingList = $describeReservedInstancesOfferingsResult->getReservedInstancesOffering();
foreach ($reservedInstancesOfferingList as $reservedInstancesOffering) {
echo " ReservedInstancesOffering\n";
if ($reservedInstancesOffering->isSetReservedInstancesOfferingId()) {
echo " ReservedInstancesOfferingId\n";
echo " " . $reservedInstancesOffering->getReservedInstancesOfferingId() . "\n";
}
if ($reservedInstancesOffering->isSetInstanceType()) {
echo " InstanceType\n";
echo " " . $reservedInstancesOffering->getInstanceType() . "\n";
}
if ($reservedInstancesOffering->isSetAvailabilityZone()) {
echo " AvailabilityZone\n";
echo " " . $reservedInstancesOffering->getAvailabilityZone() . "\n";
}
if ($reservedInstancesOffering->isSetDuration()) {
echo " Duration\n";
echo " " . $reservedInstancesOffering->getDuration() . "\n";
}
if ($reservedInstancesOffering->isSetUsagePrice()) {
echo " UsagePrice\n";
echo " " . $reservedInstancesOffering->getUsagePrice() . "\n";
}
if ($reservedInstancesOffering->isSetFixedPrice()) {
echo " FixedPrice\n";
echo " " . $reservedInstancesOffering->getFixedPrice() . "\n";
}
if ($reservedInstancesOffering->isSetProductDescription()) {
echo " ProductDescription\n";
echo " " . $reservedInstancesOffering->getProductDescription() . "\n";
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例3: invokeAllocateAddress
/**
* Allocate Address Action Sample
* The AllocateAddress operation acquires an elastic IP address for use with your
* account.
*
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_AllocateAddress or array of parameters
*/
function invokeAllocateAddress(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->allocateAddress($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " AllocateAddressResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetAllocateAddressResult()) {
echo " AllocateAddressResult\n";
$allocateAddressResult = $response->getAllocateAddressResult();
if ($allocateAddressResult->isSetPublicIp()) {
echo " PublicIp\n";
echo " " . $allocateAddressResult->getPublicIp() . "\n";
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例4: invokeCreateSpotDatafeedSubscription
/**
* Create Spot Datafeed Subscription Action Sample
* Creates the data feed for spot instances, enabling you to view Spot Instance usage logs. You can
* create one data feed per account.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_CreateSpotDatafeedSubscription or array of parameters
*/
function invokeCreateSpotDatafeedSubscription(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->createSpotDatafeedSubscription($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " CreateSpotDatafeedSubscriptionResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetCreateSpotDatafeedSubscriptionResult()) {
echo " CreateSpotDatafeedSubscriptionResult\n";
$createSpotDatafeedSubscriptionResult = $response->getCreateSpotDatafeedSubscriptionResult();
if ($createSpotDatafeedSubscriptionResult->isSetSpotDatafeedSubscription()) {
echo " SpotDatafeedSubscription\n";
$spotDatafeedSubscription = $createSpotDatafeedSubscriptionResult->getSpotDatafeedSubscription();
if ($spotDatafeedSubscription->isSetOwnerId()) {
echo " OwnerId\n";
echo " " . $spotDatafeedSubscription->getOwnerId() . "\n";
}
if ($spotDatafeedSubscription->isSetBucket()) {
echo " Bucket\n";
echo " " . $spotDatafeedSubscription->getBucket() . "\n";
}
if ($spotDatafeedSubscription->isSetPrefix()) {
echo " Prefix\n";
echo " " . $spotDatafeedSubscription->getPrefix() . "\n";
}
if ($spotDatafeedSubscription->isSetState()) {
echo " State\n";
echo " " . $spotDatafeedSubscription->getState() . "\n";
}
if ($spotDatafeedSubscription->isSetFault()) {
echo " Fault\n";
$fault = $spotDatafeedSubscription->getFault();
if ($fault->isSetCode()) {
echo " Code\n";
echo " " . $fault->getCode() . "\n";
}
if ($fault->isSetMessage()) {
echo " Message\n";
echo " " . $fault->getMessage() . "\n";
}
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例5: invokeRegisterImage
/**
* Register Image Action Sample
* The RegisterImage operation registers an AMI with Amazon EC2. Images must be
* registered before they can be launched. For more information, see RunInstances.
* Each AMI is associated with an unique ID which is provided by the Amazon EC2
* service through the RegisterImage operation. During registration, Amazon EC2
* retrieves the specified image manifest from Amazon S3 and verifies that the
* image is owned by the user registering the image.
* The image manifest is retrieved once and stored within the Amazon EC2. Any
* modifications to an image in Amazon S3 invalidates this registration. If you
* make changes to an image, deregister the previous image and register the new
* image. For more information, see DeregisterImage.
*
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_RegisterImage or array of parameters
*/
function invokeRegisterImage(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->registerImage($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " RegisterImageResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetRegisterImageResult()) {
echo " RegisterImageResult\n";
$registerImageResult = $response->getRegisterImageResult();
if ($registerImageResult->isSetImageId()) {
echo " ImageId\n";
echo " " . $registerImageResult->getImageId() . "\n";
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例6: invokePurchaseReservedInstancesOffering
/**
* Purchase Reserved Instances Offering Action Sample
* The PurchaseReservedInstancesOffering operation purchases a
* Reserved Instance for use with your account. With Amazon EC2
* Reserved Instances, you purchase the right to launch Amazon EC2
* instances for a period of time (without getting insufficient
* capacity errors) and pay a lower usage rate for the
* actual time used.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_PurchaseReservedInstancesOffering or array of parameters
*/
function invokePurchaseReservedInstancesOffering(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->purchaseReservedInstancesOffering($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " PurchaseReservedInstancesOfferingResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetPurchaseReservedInstancesOfferingResult()) {
echo " PurchaseReservedInstancesOfferingResult\n";
$purchaseReservedInstancesOfferingResult = $response->getPurchaseReservedInstancesOfferingResult();
if ($purchaseReservedInstancesOfferingResult->isSetReservedInstancesId()) {
echo " ReservedInstancesId\n";
echo " " . $purchaseReservedInstancesOfferingResult->getReservedInstancesId() . "\n";
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例7: invokeDescribeVpnGateways
/**
* Describe Vpn Gateways Action Sample
* Gives you information about your VPN gateways. You can filter the results to return
* information only about VPN gateways that match criteria you specify. For example,
* you could ask to get information about a particular VPN gateway (or all) only if the
* gateway's state is pending or available. You can specify multiple filters (e.g., the
* VPN gateway is in a particular Availability Zone and the gateway's state is pending or
* available). The result includes information for a particular VPN gateway only if the
* gateway matches all your filters. If there's no match, no special message is returned;
* the response is simply empty.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_DescribeVpnGateways or array of parameters
*/
function invokeDescribeVpnGateways(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->describeVpnGateways($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " DescribeVpnGatewaysResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetDescribeVpnGatewaysResult()) {
echo " DescribeVpnGatewaysResult\n";
$describeVpnGatewaysResult = $response->getDescribeVpnGatewaysResult();
$vpnGatewayList = $describeVpnGatewaysResult->getVpnGateway();
foreach ($vpnGatewayList as $vpnGateway) {
echo " VpnGateway\n";
if ($vpnGateway->isSetVpnGatewayId()) {
echo " VpnGatewayId\n";
echo " " . $vpnGateway->getVpnGatewayId() . "\n";
}
if ($vpnGateway->isSetVpnGatewayState()) {
echo " VpnGatewayState\n";
echo " " . $vpnGateway->getVpnGatewayState() . "\n";
}
if ($vpnGateway->isSetType()) {
echo " Type\n";
echo " " . $vpnGateway->getType() . "\n";
}
if ($vpnGateway->isSetAvailabilityZone()) {
echo " AvailabilityZone\n";
echo " " . $vpnGateway->getAvailabilityZone() . "\n";
}
$vpcAttachmentList = $vpnGateway->getVpcAttachment();
foreach ($vpcAttachmentList as $vpcAttachment) {
echo " VpcAttachment\n";
if ($vpcAttachment->isSetVpcId()) {
echo " VpcId\n";
echo " " . $vpcAttachment->getVpcId() . "\n";
}
if ($vpcAttachment->isSetVpcAttachmentState()) {
echo " VpcAttachmentState\n";
echo " " . $vpcAttachment->getVpcAttachmentState() . "\n";
}
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例8: invokeDetachVolume
/**
* Detach Volume Action Sample
* Detach a previously attached volume from a running instance.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_DetachVolume or array of parameters
*/
function invokeDetachVolume(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->detachVolume($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " DetachVolumeResponse\n";
if ($response->isSetDetachVolumeResult()) {
echo " DetachVolumeResult\n";
$detachVolumeResult = $response->getDetachVolumeResult();
if ($detachVolumeResult->isSetAttachment()) {
echo " Attachment\n";
$attachment = $detachVolumeResult->getAttachment();
if ($attachment->isSetVolumeId()) {
echo " VolumeId\n";
echo " " . $attachment->getVolumeId() . "\n";
}
if ($attachment->isSetInstanceId()) {
echo " InstanceId\n";
echo " " . $attachment->getInstanceId() . "\n";
}
if ($attachment->isSetDevice()) {
echo " Device\n";
echo " " . $attachment->getDevice() . "\n";
}
if ($attachment->isSetStatus()) {
echo " Status\n";
echo " " . $attachment->getStatus() . "\n";
}
if ($attachment->isSetAttachTime()) {
echo " AttachTime\n";
echo " " . $attachment->getAttachTime() . "\n";
}
if ($attachment->isSetDeleteOnTermination()) {
echo " DeleteOnTermination\n";
echo " " . $attachment->getDeleteOnTermination() . "\n";
}
}
}
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例9: invokeCreateVpnConnection
/**
* Create Vpn Connection Action Sample
* Creates a new VPN connection between an existing VPN gateway and customer
* gateway. The only supported connection type is ipsec.1.
* The response includes information that you need to configure your customer gateway,
* in XML format. We recommend you use the command line version of this operation
* (ec2-create-vpn-connection), which lets you get the configuration information
* formatted in a friendlier way. For information about the command, go to
* ec2-create-vpn-connection in the Amazon Virtual Private Cloud Command Line Reference.
* Important
* We strongly recommend you use HTTPS when calling this operation because
* the response contains sensitive cryptographic information for configuring
* your customer gateway.
* If you decide to shut down your VPN connection for any reason and then create a new
* one, you must re-configure your customer gateway with the new information
* returned from this call.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_CreateVpnConnection or array of parameters
*/
function invokeCreateVpnConnection(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->createVpnConnection($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " CreateVpnConnectionResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetCreateVpnConnectionResult()) {
echo " CreateVpnConnectionResult\n";
$createVpnConnectionResult = $response->getCreateVpnConnectionResult();
if ($createVpnConnectionResult->isSetVpnConnection()) {
echo " VpnConnection\n";
$vpnConnection = $createVpnConnectionResult->getVpnConnection();
if ($vpnConnection->isSetVpnConnectionId()) {
echo " VpnConnectionId\n";
echo " " . $vpnConnection->getVpnConnectionId() . "\n";
}
if ($vpnConnection->isSetVpnConnectionState()) {
echo " VpnConnectionState\n";
echo " " . $vpnConnection->getVpnConnectionState() . "\n";
}
if ($vpnConnection->isSetCustomerGatewayConfiguration()) {
echo " CustomerGatewayConfiguration\n";
echo " " . $vpnConnection->getCustomerGatewayConfiguration() . "\n";
}
if ($vpnConnection->isSetType()) {
echo " Type\n";
echo " " . $vpnConnection->getType() . "\n";
}
if ($vpnConnection->isSetCustomerGatewayId()) {
echo " CustomerGatewayId\n";
echo " " . $vpnConnection->getCustomerGatewayId() . "\n";
}
if ($vpnConnection->isSetVpnGatewayId()) {
echo " VpnGatewayId\n";
echo " " . $vpnConnection->getVpnGatewayId() . "\n";
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例10: invokeCreateSubnet
/**
* Create Subnet Action Sample
* Creates a subnet in an existing VPC. You can create up to 20 subnets in a VPC.
* If you add more than one subnet to a VPC, they're set up in a star topology with
* a logical router in the middle. If you feel you need more than 20 subnets, you can
* request more by going to http://aws.amazon.com/contact-us/vpc-request/.
* When you create each subnet, you provide the VPC ID and the CIDR block you
* want for the subnet. Once you create a subnet, you can't change its CIDR block.
* The subnet's CIDR block can be the same as the VPC's CIDR block (assuming you
* want only a single subnet in the VPC), or a subset of the VPC's CIDR block.
* If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap.
* The smallest subnet (and VPC) you can create uses a /28 netmask (16 IP addresses),
* and the largest uses a /18 netmask (16,384 IP addresses).
* Important
* AWS reserves both the first four and the last IP address in each subnet's CIDR block.
* They're not available for use.
* AWS might delete any subnet you create with this operation if you leave it inactive
* for an extended period of time (inactive means that there are no running Amazon EC2
* instances in the subnet).
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_CreateSubnet or array of parameters
*/
function invokeCreateSubnet(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->createSubnet($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " CreateSubnetResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetCreateSubnetResult()) {
echo " CreateSubnetResult\n";
$createSubnetResult = $response->getCreateSubnetResult();
if ($createSubnetResult->isSetSubnet()) {
echo " Subnet\n";
$subnet = $createSubnetResult->getSubnet();
if ($subnet->isSetSubnetId()) {
echo " SubnetId\n";
echo " " . $subnet->getSubnetId() . "\n";
}
if ($subnet->isSetSubnetState()) {
echo " SubnetState\n";
echo " " . $subnet->getSubnetState() . "\n";
}
if ($subnet->isSetVpcId()) {
echo " VpcId\n";
echo " " . $subnet->getVpcId() . "\n";
}
if ($subnet->isSetCidrBlock()) {
echo " CidrBlock\n";
echo " " . $subnet->getCidrBlock() . "\n";
}
if ($subnet->isSetAvailableIpAddressCount()) {
echo " AvailableIpAddressCount\n";
echo " " . $subnet->getAvailableIpAddressCount() . "\n";
}
if ($subnet->isSetAvailabilityZone()) {
echo " AvailabilityZone\n";
echo " " . $subnet->getAvailabilityZone() . "\n";
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例11: invokeDescribeCustomerGateways
/**
* Describe Customer Gateways Action Sample
* Gives you information about your customer gateways. You can filter the results to return
* information only about customer gateways that match criteria you specify. For example,
* you could ask to get information about a particular customer gateway (or all) only if
* the gateway's state is pending or available. You can specify multiple filters (e.g.,
* the customer gateway has a particular IP address for the Internet-routable external
* interface, and the gateway's state is pending or available). The result includes
* information for a particular customer gateway only if the gateway matches all your
* filters. If there's no match, no special message is returned; the response is simply empty.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_DescribeCustomerGateways or array of parameters
*/
function invokeDescribeCustomerGateways(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->describeCustomerGateways($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " DescribeCustomerGatewaysResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetDescribeCustomerGatewaysResult()) {
echo " DescribeCustomerGatewaysResult\n";
$describeCustomerGatewaysResult = $response->getDescribeCustomerGatewaysResult();
$customerGatewayList = $describeCustomerGatewaysResult->getCustomerGateway();
foreach ($customerGatewayList as $customerGateway) {
echo " CustomerGateway\n";
if ($customerGateway->isSetCustomerGatewayId()) {
echo " CustomerGatewayId\n";
echo " " . $customerGateway->getCustomerGatewayId() . "\n";
}
if ($customerGateway->isSetCustomerGatewayState()) {
echo " CustomerGatewayState\n";
echo " " . $customerGateway->getCustomerGatewayState() . "\n";
}
if ($customerGateway->isSetType()) {
echo " Type\n";
echo " " . $customerGateway->getType() . "\n";
}
if ($customerGateway->isSetIpAddress()) {
echo " IpAddress\n";
echo " " . $customerGateway->getIpAddress() . "\n";
}
if ($customerGateway->isSetBgpAsn()) {
echo " BgpAsn\n";
echo " " . $customerGateway->getBgpAsn() . "\n";
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例12: invokeCreateSnapshot
/**
* Create Snapshot Action Sample
* Create a snapshot of the volume identified by volume ID. A volume does not have to be detached
* at the time the snapshot is taken.
* Important Note:
* Snapshot creation requires that the system is in a consistent state.
* For instance, this means that if taking a snapshot of a database, the tables must
* be read-only locked to ensure that the snapshot will not contain a corrupted
* version of the database. Therefore, be careful when using this API to ensure that
* the system remains in the consistent state until the create snapshot status
* has returned.
*
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_CreateSnapshot or array of parameters
*/
function invokeCreateSnapshot(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->createSnapshot($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " CreateSnapshotResponse\n";
if ($response->isSetCreateSnapshotResult()) {
echo " CreateSnapshotResult\n";
$createSnapshotResult = $response->getCreateSnapshotResult();
if ($createSnapshotResult->isSetSnapshot()) {
echo " Snapshot\n";
$snapshot = $createSnapshotResult->getSnapshot();
if ($snapshot->isSetSnapshotId()) {
echo " SnapshotId\n";
echo " " . $snapshot->getSnapshotId() . "\n";
}
if ($snapshot->isSetVolumeId()) {
echo " VolumeId\n";
echo " " . $snapshot->getVolumeId() . "\n";
}
if ($snapshot->isSetStatus()) {
echo " Status\n";
echo " " . $snapshot->getStatus() . "\n";
}
if ($snapshot->isSetStartTime()) {
echo " StartTime\n";
echo " " . $snapshot->getStartTime() . "\n";
}
if ($snapshot->isSetProgress()) {
echo " Progress\n";
echo " " . $snapshot->getProgress() . "\n";
}
}
}
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例13: invokeDescribeAvailabilityZones
/**
* Describe Availability Zones Action Sample
* The DescribeAvailabilityZones operation describes availability zones that are
* currently available to the account and their states.
* Availability zones are not the same across accounts. The availability zone
* us-east-1a for account A is not necessarily the same as us-east-1a for account
* B. Zone assignments are mapped independently for each account.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_DescribeAvailabilityZones or array of parameters
*/
function invokeDescribeAvailabilityZones(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->describeAvailabilityZones($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " DescribeAvailabilityZonesResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetDescribeAvailabilityZonesResult()) {
echo " DescribeAvailabilityZonesResult\n";
$describeAvailabilityZonesResult = $response->getDescribeAvailabilityZonesResult();
$availabilityZoneList = $describeAvailabilityZonesResult->getAvailabilityZone();
foreach ($availabilityZoneList as $availabilityZone) {
echo " AvailabilityZone\n";
if ($availabilityZone->isSetZoneName()) {
echo " ZoneName\n";
echo " " . $availabilityZone->getZoneName() . "\n";
}
if ($availabilityZone->isSetZoneState()) {
echo " ZoneState\n";
echo " " . $availabilityZone->getZoneState() . "\n";
}
if ($availabilityZone->isSetRegionName()) {
echo " RegionName\n";
echo " " . $availabilityZone->getRegionName() . "\n";
}
$messageList = $availabilityZone->getMessage();
foreach ($messageList as $message) {
echo " Message\n";
echo " " . $message;
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例14: invokeCreateDhcpOptions
/**
* Create Dhcp Options Action Sample
* Creates a set of DHCP options that you can then associate with one or more VPCs,
* causing all existing and new instances that you launch in those VPCs to use the
* set of DHCP options. The following table lists the individual DHCP options you can
* specify. For more information about the options, go to RFC 2132 - http://www.ietf.org/rfc/rfc2132.txt
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_CreateDhcpOptions or array of parameters
*/
function invokeCreateDhcpOptions(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->createDhcpOptions($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " CreateDhcpOptionsResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetCreateDhcpOptionsResult()) {
echo " CreateDhcpOptionsResult\n";
$createDhcpOptionsResult = $response->getCreateDhcpOptionsResult();
if ($createDhcpOptionsResult->isSetDhcpOptions()) {
echo " DhcpOptions\n";
$dhcpOptions = $createDhcpOptionsResult->getDhcpOptions();
if ($dhcpOptions->isSetDhcpOptionsId()) {
echo " DhcpOptionsId\n";
echo " " . $dhcpOptions->getDhcpOptionsId() . "\n";
}
$configurationList = $dhcpOptions->getConfiguration();
foreach ($configurationList as $configuration) {
echo " Configuration\n";
if ($configuration->isSetKey()) {
echo " Key\n";
echo " " . $configuration->getKey() . "\n";
}
$valueList = $configuration->getValue();
foreach ($valueList as $value) {
echo " Value\n";
echo " " . $value;
}
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例15: invokeDescribeSnapshotAttribute
/**
* Describe Snapshot Attribute Action Sample
* Returns information about an attribute of a snapshot.
* Only one attribute can be specified per call.
* @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
* @param mixed $request Amazon_EC2_Model_DescribeSnapshotAttribute or array of parameters
*/
function invokeDescribeSnapshotAttribute(Amazon_EC2_Interface $service, $request)
{
try {
$response = $service->describeSnapshotAttribute($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " DescribeSnapshotAttributeResponse\n";
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
if ($response->isSetDescribeSnapshotAttributeResult()) {
echo " DescribeSnapshotAttributeResult\n";
$describeSnapshotAttributeResult = $response->getDescribeSnapshotAttributeResult();
if ($describeSnapshotAttributeResult->isSetSnapshotAttribute()) {
echo " SnapshotAttribute\n";
$snapshotAttribute = $describeSnapshotAttributeResult->getSnapshotAttribute();
if ($snapshotAttribute->isSetSnapshotId()) {
echo " SnapshotId\n";
echo " " . $snapshotAttribute->getSnapshotId() . "\n";
}
$createVolumePermissionList = $snapshotAttribute->getCreateVolumePermission();
foreach ($createVolumePermissionList as $createVolumePermission) {
echo " CreateVolumePermission\n";
if ($createVolumePermission->isSetUserId()) {
echo " UserId\n";
echo " " . $createVolumePermission->getUserId() . "\n";
}
if ($createVolumePermission->isSetGroupName()) {
echo " GroupName\n";
echo " " . $createVolumePermission->getGroupName() . "\n";
}
}
}
}
} catch (Amazon_EC2_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}