removed aws.phar and added extracted zip instead

This commit is contained in:
Christian Berendt 2013-07-08 11:11:07 +02:00
parent 92e7392852
commit adf0fe880c
1228 changed files with 176428 additions and 1 deletions

View File

@ -0,0 +1,126 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling;
use Aws\Common\Client\AbstractClient;
use Aws\Common\Client\ClientBuilder;
use Aws\Common\Enum\ClientOptions as Options;
use Guzzle\Common\Collection;
use Guzzle\Service\Resource\Model;
use Guzzle\Service\Resource\ResourceIteratorInterface;
/**
* Client to interact with Auto Scaling
*
* @method Model createAutoScalingGroup(array $args = array()) {@command AutoScaling CreateAutoScalingGroup}
* @method Model createLaunchConfiguration(array $args = array()) {@command AutoScaling CreateLaunchConfiguration}
* @method Model createOrUpdateTags(array $args = array()) {@command AutoScaling CreateOrUpdateTags}
* @method Model deleteAutoScalingGroup(array $args = array()) {@command AutoScaling DeleteAutoScalingGroup}
* @method Model deleteLaunchConfiguration(array $args = array()) {@command AutoScaling DeleteLaunchConfiguration}
* @method Model deleteNotificationConfiguration(array $args = array()) {@command AutoScaling DeleteNotificationConfiguration}
* @method Model deletePolicy(array $args = array()) {@command AutoScaling DeletePolicy}
* @method Model deleteScheduledAction(array $args = array()) {@command AutoScaling DeleteScheduledAction}
* @method Model deleteTags(array $args = array()) {@command AutoScaling DeleteTags}
* @method Model describeAdjustmentTypes(array $args = array()) {@command AutoScaling DescribeAdjustmentTypes}
* @method Model describeAutoScalingGroups(array $args = array()) {@command AutoScaling DescribeAutoScalingGroups}
* @method Model describeAutoScalingInstances(array $args = array()) {@command AutoScaling DescribeAutoScalingInstances}
* @method Model describeAutoScalingNotificationTypes(array $args = array()) {@command AutoScaling DescribeAutoScalingNotificationTypes}
* @method Model describeLaunchConfigurations(array $args = array()) {@command AutoScaling DescribeLaunchConfigurations}
* @method Model describeMetricCollectionTypes(array $args = array()) {@command AutoScaling DescribeMetricCollectionTypes}
* @method Model describeNotificationConfigurations(array $args = array()) {@command AutoScaling DescribeNotificationConfigurations}
* @method Model describePolicies(array $args = array()) {@command AutoScaling DescribePolicies}
* @method Model describeScalingActivities(array $args = array()) {@command AutoScaling DescribeScalingActivities}
* @method Model describeScalingProcessTypes(array $args = array()) {@command AutoScaling DescribeScalingProcessTypes}
* @method Model describeScheduledActions(array $args = array()) {@command AutoScaling DescribeScheduledActions}
* @method Model describeTags(array $args = array()) {@command AutoScaling DescribeTags}
* @method Model describeTerminationPolicyTypes(array $args = array()) {@command AutoScaling DescribeTerminationPolicyTypes}
* @method Model disableMetricsCollection(array $args = array()) {@command AutoScaling DisableMetricsCollection}
* @method Model enableMetricsCollection(array $args = array()) {@command AutoScaling EnableMetricsCollection}
* @method Model executePolicy(array $args = array()) {@command AutoScaling ExecutePolicy}
* @method Model putNotificationConfiguration(array $args = array()) {@command AutoScaling PutNotificationConfiguration}
* @method Model putScalingPolicy(array $args = array()) {@command AutoScaling PutScalingPolicy}
* @method Model putScheduledUpdateGroupAction(array $args = array()) {@command AutoScaling PutScheduledUpdateGroupAction}
* @method Model resumeProcesses(array $args = array()) {@command AutoScaling ResumeProcesses}
* @method Model setDesiredCapacity(array $args = array()) {@command AutoScaling SetDesiredCapacity}
* @method Model setInstanceHealth(array $args = array()) {@command AutoScaling SetInstanceHealth}
* @method Model suspendProcesses(array $args = array()) {@command AutoScaling SuspendProcesses}
* @method Model terminateInstanceInAutoScalingGroup(array $args = array()) {@command AutoScaling TerminateInstanceInAutoScalingGroup}
* @method Model updateAutoScalingGroup(array $args = array()) {@command AutoScaling UpdateAutoScalingGroup}
* @method ResourceIteratorInterface getDescribeAutoScalingGroupsIterator(array $args = array()) The input array uses the parameters of the DescribeAutoScalingGroups operation
* @method ResourceIteratorInterface getDescribeAutoScalingInstancesIterator(array $args = array()) The input array uses the parameters of the DescribeAutoScalingInstances operation
* @method ResourceIteratorInterface getDescribeLaunchConfigurationsIterator(array $args = array()) The input array uses the parameters of the DescribeLaunchConfigurations operation
* @method ResourceIteratorInterface getDescribeNotificationConfigurationsIterator(array $args = array()) The input array uses the parameters of the DescribeNotificationConfigurations operation
* @method ResourceIteratorInterface getDescribePoliciesIterator(array $args = array()) The input array uses the parameters of the DescribePolicies operation
* @method ResourceIteratorInterface getDescribeScalingActivitiesIterator(array $args = array()) The input array uses the parameters of the DescribeScalingActivities operation
* @method ResourceIteratorInterface getDescribeScheduledActionsIterator(array $args = array()) The input array uses the parameters of the DescribeScheduledActions operation
* @method ResourceIteratorInterface getDescribeTagsIterator(array $args = array()) The input array uses the parameters of the DescribeTags operation
*
* @link http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/service-autoscaling.html User guide
* @link http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.AutoScaling.AutoScalingClient.html API docs
*/
class AutoScalingClient extends AbstractClient
{
const LATEST_API_VERSION = '2011-01-01';
/**
* Factory method to create a new Auto Scaling client using an array of configuration options.
*
* The following array keys and values are available options:
*
* - Credential options (`key`, `secret`, and optional `token` OR `credentials` is required)
* - key: AWS Access Key ID
* - secret: AWS secret access key
* - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
* - token: Custom AWS security token to use with request authentication
* - token.ttd: UNIX timestamp for when the custom credentials expire
* - credentials.cache.key: Optional custom cache key to use with the credentials
* - Region and Endpoint options (a `region` and optional `scheme` OR a `base_url` is required)
* - region: Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
* - scheme: URI Scheme of the base URL (e.g. 'https', 'http').
* - base_url: Instead of using a `region` and `scheme`, you can specify a custom base URL for the client
* - Generic client options
* - ssl.cert: Set to true to use the bundled CA cert or pass the full path to an SSL certificate bundle. This
* option should be used when you encounter curl error code 60.
* - curl.CURLOPT_VERBOSE: Set to true to output curl debug information during transfers
* - curl.*: Prefix any available cURL option with `curl.` to add cURL options to each request.
* See: http://www.php.net/manual/en/function.curl-setopt.php
* - service.description.cache.ttl: Optional TTL used for the service description cache
* - Signature options
* - signature: You can optionally provide a custom signature implementation used to sign requests
* - signature.service: Set to explicitly override the service name used in signatures
* - signature.region: Set to explicitly override the region name used in signatures
* - Exponential backoff options
* - client.backoff.logger: `Guzzle\Common\Log\LogAdapterInterface` object used to log backoff retries. Use
* 'debug' to emit PHP warnings when a retry is issued.
* - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See
* `Guzzle\Http\Plugin\ExponentialBackoffLogger` for formatting information.
*
* @param array|Collection $config Client configuration data
*
* @return self
*/
public static function factory($config = array())
{
return ClientBuilder::factory(__NAMESPACE__)
->setConfig($config)
->setConfigDefaults(array(
Options::VERSION => self::LATEST_API_VERSION,
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/autoscaling-%s.php'
))
->build();
}
}

View File

@ -0,0 +1,31 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable LifecycleState values
*/
class LifecycleState extends Enum
{
const PENDING = 'Pending';
const QUARANTINED = 'Quarantined';
const IN_SERVICE = 'InService';
const TERMINATING = 'Terminating';
const TERMINATED = 'Terminated';
}

View File

@ -0,0 +1,34 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable ScalingActivityStatusCode values
*/
class ScalingActivityStatusCode extends Enum
{
const WAITING_FOR_SPOT_INSTANCE_REQUEST_ID = 'WaitingForSpotInstanceRequestId';
const WAITING_FOR_SPOT_INSTANCE_ID = 'WaitingForSpotInstanceId';
const WAITING_FOR_INSTANCE_ID = 'WaitingForInstanceId';
const PRE_IN_SERVICE = 'PreInService';
const IN_PROGRESS = 'InProgress';
const SUCCESSFUL = 'Successful';
const FAILED = 'Failed';
const CANCELLED = 'Cancelled';
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Exception;
/**
* The named Auto Scaling group or launch configuration already exists.
*/
class AlreadyExistsException extends AutoScalingException {}

View File

@ -0,0 +1,24 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Exception;
use Aws\Common\Exception\ServiceResponseException;
/**
* Default service exception class
*/
class AutoScalingException extends ServiceResponseException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Exception;
/**
* The NextToken value is invalid.
*/
class InvalidNextTokenException extends AutoScalingException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Exception;
/**
* The quota for capacity groups or launch configurations for this customer has already been reached.
*/
class LimitExceededException extends AutoScalingException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Exception;
/**
* This is returned when you cannot delete a launch configuration or Auto Scaling group because it is being used.
*/
class ResourceInUseException extends AutoScalingException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\AutoScaling\Exception;
/**
* You cannot delete an Auto Scaling group while there are scaling activities in progress for that group.
*/
class ScalingActivityInProgressException extends AutoScalingException {}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation;
use Aws\Common\Client\AbstractClient;
use Aws\Common\Client\ClientBuilder;
use Aws\Common\Enum\ClientOptions as Options;
use Guzzle\Common\Collection;
use Guzzle\Service\Resource\Model;
use Guzzle\Service\Resource\ResourceIteratorInterface;
/**
* Client to interact with AWS CloudFormation
*
* @method Model cancelUpdateStack(array $args = array()) {@command CloudFormation CancelUpdateStack}
* @method Model createStack(array $args = array()) {@command CloudFormation CreateStack}
* @method Model deleteStack(array $args = array()) {@command CloudFormation DeleteStack}
* @method Model describeStackEvents(array $args = array()) {@command CloudFormation DescribeStackEvents}
* @method Model describeStackResource(array $args = array()) {@command CloudFormation DescribeStackResource}
* @method Model describeStackResources(array $args = array()) {@command CloudFormation DescribeStackResources}
* @method Model describeStacks(array $args = array()) {@command CloudFormation DescribeStacks}
* @method Model estimateTemplateCost(array $args = array()) {@command CloudFormation EstimateTemplateCost}
* @method Model getTemplate(array $args = array()) {@command CloudFormation GetTemplate}
* @method Model listStackResources(array $args = array()) {@command CloudFormation ListStackResources}
* @method Model listStacks(array $args = array()) {@command CloudFormation ListStacks}
* @method Model updateStack(array $args = array()) {@command CloudFormation UpdateStack}
* @method Model validateTemplate(array $args = array()) {@command CloudFormation ValidateTemplate}
* @method ResourceIteratorInterface getDescribeStackEventsIterator(array $args = array()) The input array uses the parameters of the DescribeStackEvents operation
* @method ResourceIteratorInterface getDescribeStacksIterator(array $args = array()) The input array uses the parameters of the DescribeStacks operation
* @method ResourceIteratorInterface getListStackResourcesIterator(array $args = array()) The input array uses the parameters of the ListStackResources operation
* @method ResourceIteratorInterface getListStacksIterator(array $args = array()) The input array uses the parameters of the ListStacks operation
*
* @link http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/service-cloudformation.html User guide
* @link http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.CloudFormation.CloudFormationClient.html API docs
*/
class CloudFormationClient extends AbstractClient
{
const LATEST_API_VERSION = '2010-05-15';
/**
* Factory method to create a new AWS CloudFormation client using an array of configuration options.
*
* The following array keys and values are available options:
*
* - Credential options (`key`, `secret`, and optional `token` OR `credentials` is required)
* - key: AWS Access Key ID
* - secret: AWS secret access key
* - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
* - token: Custom AWS security token to use with request authentication
* - token.ttd: UNIX timestamp for when the custom credentials expire
* - credentials.cache.key: Optional custom cache key to use with the credentials
* - Region and Endpoint options (a `region` and optional `scheme` OR a `base_url` is required)
* - region: Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
* - scheme: URI Scheme of the base URL (e.g. 'https', 'http').
* - base_url: Instead of using a `region` and `scheme`, you can specify a custom base URL for the client
* - endpoint_provider: Optional `Aws\Common\Region\EndpointProviderInterface` used to provide region endpoints
* - Generic client options
* - ssl.cert: Set to true to use the bundled CA cert or pass the full path to an SSL certificate bundle. This
* option should be used when you encounter curl error code 60.
* - curl.CURLOPT_VERBOSE: Set to true to output curl debug information during transfers
* - curl.*: Prefix any available cURL option with `curl.` to add cURL options to each request.
* See: http://www.php.net/manual/en/function.curl-setopt.php
* - service.description.cache.ttl: Optional TTL used for the service description cache
* - Signature options
* - signature: You can optionally provide a custom signature implementation used to sign requests
* - signature.service: Set to explicitly override the service name used in signatures
* - signature.region: Set to explicitly override the region name used in signatures
* - Exponential backoff options
* - client.backoff.logger: `Guzzle\Common\Log\LogAdapterInterface` object used to log backoff retries. Use
* 'debug' to emit PHP warnings when a retry is issued.
* - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See
* `Guzzle\Http\Plugin\ExponentialBackoffLogger` for formatting information.
*
* @param array|Collection $config Client configuration data
*
* @return self
*/
public static function factory($config = array())
{
return ClientBuilder::factory(__NAMESPACE__)
->setConfig($config)
->setConfigDefaults(array(
Options::VERSION => self::LATEST_API_VERSION,
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/cloudformation-%s.php'
))
->build();
}
}

View File

@ -0,0 +1,27 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable Capability values
*/
class Capability extends Enum
{
const CAPABILITY_IAM = 'CAPABILITY_IAM';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable OnFailure values
*/
class OnFailure extends Enum
{
const DO_NOTHING = 'DO_NOTHING';
const ROLLBACK = 'ROLLBACK';
const DELETE = 'DELETE';
}

View File

@ -0,0 +1,35 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable ResourceStatus values
*/
class ResourceStatus extends Enum
{
const CREATE_IN_PROGRESS = 'CREATE_IN_PROGRESS';
const CREATE_FAILED = 'CREATE_FAILED';
const CREATE_COMPLETE = 'CREATE_COMPLETE';
const DELETE_IN_PROGRESS = 'DELETE_IN_PROGRESS';
const DELETE_FAILED = 'DELETE_FAILED';
const DELETE_COMPLETE = 'DELETE_COMPLETE';
const UPDATE_IN_PROGRESS = 'UPDATE_IN_PROGRESS';
const UPDATE_FAILED = 'UPDATE_FAILED';
const UPDATE_COMPLETE = 'UPDATE_COMPLETE';
}

View File

@ -0,0 +1,42 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable StackStatus values
*/
class StackStatus extends Enum
{
const CREATE_IN_PROGRESS = 'CREATE_IN_PROGRESS';
const CREATE_FAILED = 'CREATE_FAILED';
const CREATE_COMPLETE = 'CREATE_COMPLETE';
const ROLLBACK_IN_PROGRESS = 'ROLLBACK_IN_PROGRESS';
const ROLLBACK_FAILED = 'ROLLBACK_FAILED';
const ROLLBACK_COMPLETE = 'ROLLBACK_COMPLETE';
const DELETE_IN_PROGRESS = 'DELETE_IN_PROGRESS';
const DELETE_FAILED = 'DELETE_FAILED';
const DELETE_COMPLETE = 'DELETE_COMPLETE';
const UPDATE_IN_PROGRESS = 'UPDATE_IN_PROGRESS';
const UPDATE_COMPLETE_CLEANUP_IN_PROGRESS = 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS';
const UPDATE_COMPLETE = 'UPDATE_COMPLETE';
const UPDATE_ROLLBACK_IN_PROGRESS = 'UPDATE_ROLLBACK_IN_PROGRESS';
const UPDATE_ROLLBACK_FAILED = 'UPDATE_ROLLBACK_FAILED';
const UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS = 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS';
const UPDATE_ROLLBACK_COMPLETE = 'UPDATE_ROLLBACK_COMPLETE';
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Exception;
/**
* Resource with the name requested already exists.
*/
class AlreadyExistsException extends CloudFormationException {}

View File

@ -0,0 +1,24 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Exception;
use Aws\Common\Exception\ServiceResponseException;
/**
* Default service exception class
*/
class CloudFormationException extends ServiceResponseException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Exception;
/**
* The template contains resources with capabilities that were not specified in the Capabilities parameter.
*/
class InsufficientCapabilitiesException extends CloudFormationException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFormation\Exception;
/**
* Quota for the resource has already been reached.
*/
class LimitExceededException extends CloudFormationException {}

View File

@ -0,0 +1,271 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront;
use Aws\Common\Client\AbstractClient;
use Aws\Common\Client\ClientBuilder;
use Aws\Common\Credentials\Credentials;
use Aws\Common\Enum\ClientOptions as Options;
use Aws\Common\Exception\InvalidArgumentException;
use Aws\Common\Exception\Parser\DefaultXmlExceptionParser;
use Aws\Common\Exception\RequiredExtensionNotLoadedException;
use Guzzle\Common\Collection;
use Guzzle\Http\Url;
use Guzzle\Service\Resource\Model;
use Guzzle\Service\Resource\ResourceIteratorInterface;
/**
* Client to interact with Amazon CloudFront
*
* @method Model createCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront CreateCloudFrontOriginAccessIdentity}
* @method Model createDistribution(array $args = array()) {@command CloudFront CreateDistribution}
* @method Model createInvalidation(array $args = array()) {@command CloudFront CreateInvalidation}
* @method Model createStreamingDistribution(array $args = array()) {@command CloudFront CreateStreamingDistribution}
* @method Model deleteCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront DeleteCloudFrontOriginAccessIdentity}
* @method Model deleteDistribution(array $args = array()) {@command CloudFront DeleteDistribution}
* @method Model deleteStreamingDistribution(array $args = array()) {@command CloudFront DeleteStreamingDistribution}
* @method Model getCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront GetCloudFrontOriginAccessIdentity}
* @method Model getCloudFrontOriginAccessIdentityConfig(array $args = array()) {@command CloudFront GetCloudFrontOriginAccessIdentityConfig}
* @method Model getDistribution(array $args = array()) {@command CloudFront GetDistribution}
* @method Model getDistributionConfig(array $args = array()) {@command CloudFront GetDistributionConfig}
* @method Model getInvalidation(array $args = array()) {@command CloudFront GetInvalidation}
* @method Model getStreamingDistribution(array $args = array()) {@command CloudFront GetStreamingDistribution}
* @method Model getStreamingDistributionConfig(array $args = array()) {@command CloudFront GetStreamingDistributionConfig}
* @method Model listCloudFrontOriginAccessIdentities(array $args = array()) {@command CloudFront ListCloudFrontOriginAccessIdentities}
* @method Model listDistributions(array $args = array()) {@command CloudFront ListDistributions}
* @method Model listInvalidations(array $args = array()) {@command CloudFront ListInvalidations}
* @method Model listStreamingDistributions(array $args = array()) {@command CloudFront ListStreamingDistributions}
* @method Model updateCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront UpdateCloudFrontOriginAccessIdentity}
* @method Model updateDistribution(array $args = array()) {@command CloudFront UpdateDistribution}
* @method Model updateStreamingDistribution(array $args = array()) {@command CloudFront UpdateStreamingDistribution}
* @method waitUntilStreamingDistributionDeployed(array $input) Wait until a streaming distribution is deployed. The input array uses the parameters of the GetStreamingDistribution operation and waiter specific settings
* @method waitUntilDistributionDeployed(array $input) Wait until a distribution is deployed. The input array uses the parameters of the GetDistribution operation and waiter specific settings
* @method waitUntilInvalidationCompleted(array $input) Wait until an invalidation has completed. The input array uses the parameters of the GetInvalidation operation and waiter specific settings
* @method ResourceIteratorInterface getListCloudFrontOriginAccessIdentitiesIterator(array $args = array()) The input array uses the parameters of the ListCloudFrontOriginAccessIdentities operation
* @method ResourceIteratorInterface getListDistributionsIterator(array $args = array()) The input array uses the parameters of the ListDistributions operation
* @method ResourceIteratorInterface getListInvalidationsIterator(array $args = array()) The input array uses the parameters of the ListInvalidations operation
* @method ResourceIteratorInterface getListStreamingDistributionsIterator(array $args = array()) The input array uses the parameters of the ListStreamingDistributions operation
*
* @link http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/service-cloudfront.html User guide
* @link http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.CloudFront.CloudFrontClient.html API docs
*/
class CloudFrontClient extends AbstractClient
{
const LATEST_API_VERSION = '2013-05-12';
/**
* Factory method to create a new Amazon CloudFront client using an array of configuration options:
*
* Credential options (`key`, `secret`, and optional `token` OR `credentials` is required)
*
* - key: AWS Access Key ID
* - secret: AWS secret access key
* - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
* - token: Custom AWS security token to use with request authentication
* - token.ttd: UNIX timestamp for when the custom credentials expire
* - credentials.cache: Used to cache credentials when using providers that require HTTP requests. Set the true
* to use the default APC cache or provide a `Guzzle\Cache\CacheAdapterInterface` object.
* - credentials.cache.key: Optional custom cache key to use with the credentials
* - credentials.client: Pass this option to specify a custom `Guzzle\Http\ClientInterface` to use if your
* credentials require a HTTP request (e.g. RefreshableInstanceProfileCredentials)
*
* Region and Endpoint options
*
* - base_url: Instead of using a `region` and `scheme`, you can specify a custom base URL for the client
*
* Generic client options
*
* - ssl.certificate_authority: Set to true to use the bundled CA cert (default), system to use the certificate
* bundled with your system, or pass the full path to an SSL certificate bundle. This option should be used when
* you encounter curl error code 60.
* - curl.options: Array of cURL options to apply to every request.
* See http://www.php.net/manual/en/function.curl-setopt.php for a list of available options
* - client.backoff.logger: `Guzzle\Log\LogAdapterInterface` object used to log backoff retries. Use
* 'debug' to emit PHP warnings when a retry is issued.
* - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See
* `Guzzle\Plugin\Backoff\BackoffLogger` for formatting information.
*
* Options specific to CloudFront
*
* - key_pair_id: The ID of the key pair used to sign CloudFront URLs for private distributions.
* - private_key: The filepath ot the private key used to sign CloudFront URLs for private distributions.
*
* @param array|Collection $config Client configuration data
*
* @return self
*/
public static function factory($config = array())
{
// Decide which signature to use
if (isset($config[Options::VERSION]) && $config[Options::VERSION] < self::LATEST_API_VERSION) {
$config[Options::SIGNATURE] = new CloudFrontSignature();
}
// Instantiate the CloudFront client
return ClientBuilder::factory(__NAMESPACE__)
->setConfig($config)
->setConfigDefaults(array(
Options::VERSION => self::LATEST_API_VERSION,
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/cloudfront-%s.php',
))
->setExceptionParser(new DefaultXmlExceptionParser())
->setIteratorsConfig(array(
'token_param' => 'Marker',
'token_key' => 'NextMarker',
'more_key' => 'IsTruncated',
'result_key' => 'Items',
'operations' => array(
'ListCloudFrontOriginAccessIdentities',
'ListDistributions',
'ListInvalidations',
'ListStreamingDistributions'
)
))
->build();
}
/**
* Create a signed URL. Keep in mind that URLs meant for use in media/flash players may have different requirements
* for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed -
* mp4:<path>, some require you to add "/cfx/st" into your URL). See
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html for
* additional details and help.
*
* This method accepts an array of configuration options:
* - url: (string) URL of the resource being signed (can include query string and wildcards). For example:
* rtmp://s5c39gqb8ow64r.cloudfront.net/videos/mp3_name.mp3
* http://d111111abcdef8.cloudfront.net/images/horizon.jpg?size=large&license=yes
* - policy: (string) JSON policy. Use this option when creating a signed URL for a custom policy.
* - expires: (int) UTC Unix timestamp used when signing with a canned policy. Not required when passing a
* custom 'policy' option.
* - key_pair_id: (string) The ID of the key pair used to sign CloudFront URLs for private distributions.
* - private_key: (string) The filepath ot the private key used to sign CloudFront URLs for private distributions.
*
* @param array $options Array of configuration options used when signing
*
* @return string The file URL with authentication parameters
* @throws InvalidArgumentException if key_pair_id and private_key have not been configured on the client
* @throws RequiredExtensionNotLoadedException if the openssl extension is not installed
* @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html
*/
public function getSignedUrl(array $options)
{
if (!extension_loaded('openssl')) {
//@codeCoverageIgnoreStart
throw new RequiredExtensionNotLoadedException('The openssl extension is required to sign CloudFront urls.');
//@codeCoverageIgnoreEnd
}
// Initialize the configuration data and ensure that the url was specified
$options = Collection::fromConfig($options, array_filter(array(
'key_pair_id' => $this->getConfig('key_pair_id'),
'private_key' => $this->getConfig('private_key'),
)), array('url', 'key_pair_id', 'private_key'));
// Determine the scheme of the url
$urlSections = explode('://', $options['url']);
if (count($urlSections) < 2) {
throw new InvalidArgumentException('Invalid URL: ' . $options['url']);
}
// Get the real scheme by removing wildcards from the scheme
$scheme = str_replace('*', '', $urlSections[0]);
$policy = $options['policy'] ?: $this->createCannedPolicy($scheme, $options['url'], $options['expires']);
// Strip whitespace from the policy
$policy = str_replace(' ', '', $policy);
$url = Url::factory($scheme . '://' . $urlSections[1]);
if ($options['policy']) {
// Custom policies require that the encoded policy be specified in the URL
$url->getQuery()->set('Policy', strtr(base64_encode($policy), '+=/', '-_~'));
} else {
// Canned policies require that the Expires parameter be set in the URL
$url->getQuery()->set('Expires', $options['expires']);
}
// Sign the policy using the CloudFront private key
$signedPolicy = $this->rsaSha1Sign($policy, $options['private_key']);
// Remove whitespace, base64 encode the policy, and replace special characters
$signedPolicy = strtr(base64_encode($signedPolicy), '+=/', '-_~');
$url->getQuery()
->useUrlEncoding(false)
->set('Signature', $signedPolicy)
->set('Key-Pair-Id', $options['key_pair_id']);
if ($scheme != 'rtmp') {
// HTTP and HTTPS signed URLs include the full URL
return (string) $url;
} else {
// Use a relative URL when creating Flash player URLs
$url->setScheme(null)->setHost(null);
return substr($url, 1);
}
}
/**
* Sign a policy string using OpenSSL RSA SHA1
*
* @param string $policy Policy to sign
* @param string $privateKeyFilename File containing the OpenSSL private key
*
* @return string
*/
protected function rsaSha1Sign($policy, $privateKeyFilename)
{
$signature = '';
openssl_sign($policy, $signature, file_get_contents($privateKeyFilename));
return $signature;
}
/**
* Create a canned policy for a particular URL and expiration
*
* @param string $scheme Parsed scheme without wildcards
* @param string $url URL that is being signed
* @param int $expires Time in which the signature expires
*
* @return string
* @throws InvalidArgumentException if the expiration is not set
*/
protected function createCannedPolicy($scheme, $url, $expires)
{
if (!$expires) {
throw new InvalidArgumentException('An expires option is required when using a canned policy');
}
// Generate a canned policy
if ($scheme == 'http' || $scheme == 'https') {
$resource = $url;
} elseif ($scheme == 'rtmp') {
$parts = parse_url($url);
$pathParts = pathinfo($parts['path']);
// Add path leading to file, strip file extension, and add a query string if present
$resource = ltrim($pathParts['dirname'] . '/' . $pathParts['basename'], '/')
. (isset($parts['query']) ? "?{$parts['query']}" : '');
} else {
throw new InvalidArgumentException("Invalid URI scheme: {$scheme}. Must be one of http or rtmp.");
}
return sprintf(
'{"Statement":[{"Resource":"%s","Condition":{"DateLessThan":{"AWS:EpochTime":%d}}}]}',
$resource,
$expires
);
}
}

View File

@ -0,0 +1,61 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront;
use Aws\Common\Credentials\CredentialsInterface;
use Aws\Common\Enum\DateFormat;
use Aws\Common\Signature\SignatureInterface;
use Guzzle\Http\Message\RequestInterface;
/**
* Amazon CloudFront signature implementation
* @link http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/RESTAuthentication.html
*/
class CloudFrontSignature implements SignatureInterface
{
/**
* {@inheritdoc}
*/
public function signRequest(RequestInterface $request, CredentialsInterface $credentials)
{
// Add a date header if one is not set
if (!$request->hasHeader('date') && !$request->hasHeader('x-amz-date')) {
$request->setHeader('Date', gmdate(DateFormat::RFC2822));
}
$stringToSign = (string) $request->getHeader('Date') ?: (string) $request->getHeader('x-amz-date');
$request->getParams()->set('aws.string_to_sign', $stringToSign);
$request->setHeader(
'Authorization',
'AWS ' . $credentials->getAccessKeyId() . ':' . $this->signString($stringToSign, $credentials)
);
}
/**
* Sign a signature string by applying SHA-1 HMAC hashing.
*
* @param string $string The signature string to hash.
* @param CredentialsInterface $credentials Signing credentials.
*
* @return string The hashed signature string.
*/
public function signString($string, CredentialsInterface $credentials)
{
return base64_encode(hash_hmac('sha1', $string, $credentials->getSecretKey(), true));
}
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable ItemSelection values
*/
class ItemSelection extends Enum
{
const NONE = 'none';
const WHITELIST = 'whitelist';
const ALL = 'all';
}

View File

@ -0,0 +1,28 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable OriginProtocolPolicy values
*/
class OriginProtocolPolicy extends Enum
{
const HTTP_ONLY = 'http-only';
const MATCH_VIEWER = 'match-viewer';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable PriceClass values
*/
class PriceClass extends Enum
{
const PRICE_CLASS_100 = 'PriceClass_100';
const PRICE_CLASS_200 = 'PriceClass_200';
const PRICE_CLASS_ALL = 'PriceClass_All';
}

View File

@ -0,0 +1,28 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable ViewerProtocolPolicy values
*/
class ViewerProtocolPolicy extends Enum
{
const ALLOW_ALL = 'allow-all';
const HTTPS_ONLY = 'https-only';
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Access denied.
*/
class AccessDeniedException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a BatchTooLargeException error is encountered
*/
class BatchTooLargeException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a CNAMEAlreadyExistsException error is encountered
*/
class CNAMEAlreadyExistsException extends CloudFrontException {}

View File

@ -0,0 +1,24 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
use Aws\Common\Exception\ServiceResponseException;
/**
* Default service exception class
*/
class CloudFrontException extends ServiceResponseException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* If the CallerReference is a value you already sent in a previous request to create an identity but the content of the CloudFrontOriginAccessIdentityConfig is different from the original request, CloudFront returns a CloudFrontOriginAccessIdentityAlreadyExists error.
*/
class CloudFrontOriginAccessIdentityAlreadyExistsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a CloudFrontOriginAccessIdentityInUseException error is encountered
*/
class CloudFrontOriginAccessIdentityInUseException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The caller reference you attempted to create the distribution with is associated with another distribution.
*/
class DistributionAlreadyExistsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a DistributionNotDisabledException error is encountered
*/
class DistributionNotDisabledException extends CloudFrontException {}

View File

@ -0,0 +1,24 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
use Aws\Common\Exception\ServiceResponseException;
/**
* Default service exception class
*/
class Exception extends ServiceResponseException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Origin and CallerReference cannot be updated.
*/
class IllegalUpdateException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The value of Quantity and the size of Items do not match.
*/
class InconsistentQuantitiesException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The argument is invalid.
*/
class InvalidArgumentException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The default root object file name is too big or contains an invalid character.
*/
class InvalidDefaultRootObjectException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Your request contains forward cookies option which doesn&#039;t match with the expectation for the whitelisted list of cookie names. Either list of cookie names has been specified when not allowed or list of cookie names is missing when expected.
*/
class InvalidForwardCookiesException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The If-Match version is missing or not valid for the distribution.
*/
class InvalidIfMatchVersionException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The origin access identity is not valid or doesn&#039;t exist.
*/
class InvalidOriginAccessIdentityException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The Amazon S3 origin server specified does not refer to a valid Amazon S3 bucket.
*/
class InvalidOriginException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* This operation requires the HTTPS protocol. Ensure that you specify the HTTPS protocol in your request, or omit the RequiredProtocols element from your distribution configuration.
*/
class InvalidRequiredProtocolException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a InvalidViewerCertificateException error is encountered
*/
class InvalidViewerCertificateException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* This operation requires a body. Ensure that the body is present and the Content-Type header is set.
*/
class MissingBodyException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The specified origin access identity does not exist.
*/
class NoSuchCloudFrontOriginAccessIdentityException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The specified distribution does not exist.
*/
class NoSuchDistributionException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The specified invalidation does not exist.
*/
class NoSuchInvalidationException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* No origin exists with the specified Origin Id.
*/
class NoSuchOriginException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The specified streaming distribution does not exist.
*/
class NoSuchStreamingDistributionException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* The precondition given in one or more of the request-header fields evaluated to false.
*/
class PreconditionFailedException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a StreamingDistributionAlreadyExistsException error is encountered
*/
class StreamingDistributionAlreadyExistsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a StreamingDistributionNotDisabledException error is encountered
*/
class StreamingDistributionNotDisabledException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* You cannot create anymore cache behaviors for the distribution.
*/
class TooManyCacheBehaviorsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* You cannot create anymore custom ssl certificates.
*/
class TooManyCertificatesException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Processing your request would cause you to exceed the maximum number of origin access identities allowed.
*/
class TooManyCloudFrontOriginAccessIdentitiesException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Your request contains more cookie names in the whitelist than are allowed per cache behavior.
*/
class TooManyCookieNamesInWhiteListException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Your request contains more CNAMEs than are allowed per distribution.
*/
class TooManyDistributionCNAMEsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Processing your request would cause you to exceed the maximum number of distributions allowed.
*/
class TooManyDistributionsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* You have exceeded the maximum number of allowable InProgress invalidation batch requests, or invalidation objects.
*/
class TooManyInvalidationsInProgressException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* You cannot create anymore origins for the distribution.
*/
class TooManyOriginsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Exception that occurs when a TooManyStreamingDistributionCNAMEsException error is encountered
*/
class TooManyStreamingDistributionCNAMEsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Processing your request would cause you to exceed the maximum number of streaming distributions allowed.
*/
class TooManyStreamingDistributionsException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* Your request contains more trusted signers than are allowed per distribution.
*/
class TooManyTrustedSignersException extends CloudFrontException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudFront\Exception;
/**
* One or more of your trusted signers do not exist.
*/
class TrustedSignerDoesNotExistException extends CloudFrontException {}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,107 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch;
use Aws\Common\Client\AbstractClient;
use Aws\Common\Client\ClientBuilder;
use Aws\Common\Enum\ClientOptions as Options;
use Guzzle\Common\Collection;
use Guzzle\Service\Resource\Model;
use Guzzle\Service\Resource\ResourceIteratorInterface;
/**
* Client to interact with Amazon CloudSearch
*
* @method Model createDomain(array $args = array()) {@command CloudSearch CreateDomain}
* @method Model defineIndexField(array $args = array()) {@command CloudSearch DefineIndexField}
* @method Model defineRankExpression(array $args = array()) {@command CloudSearch DefineRankExpression}
* @method Model deleteDomain(array $args = array()) {@command CloudSearch DeleteDomain}
* @method Model deleteIndexField(array $args = array()) {@command CloudSearch DeleteIndexField}
* @method Model deleteRankExpression(array $args = array()) {@command CloudSearch DeleteRankExpression}
* @method Model describeDefaultSearchField(array $args = array()) {@command CloudSearch DescribeDefaultSearchField}
* @method Model describeDomains(array $args = array()) {@command CloudSearch DescribeDomains}
* @method Model describeIndexFields(array $args = array()) {@command CloudSearch DescribeIndexFields}
* @method Model describeRankExpressions(array $args = array()) {@command CloudSearch DescribeRankExpressions}
* @method Model describeServiceAccessPolicies(array $args = array()) {@command CloudSearch DescribeServiceAccessPolicies}
* @method Model describeStemmingOptions(array $args = array()) {@command CloudSearch DescribeStemmingOptions}
* @method Model describeStopwordOptions(array $args = array()) {@command CloudSearch DescribeStopwordOptions}
* @method Model describeSynonymOptions(array $args = array()) {@command CloudSearch DescribeSynonymOptions}
* @method Model indexDocuments(array $args = array()) {@command CloudSearch IndexDocuments}
* @method Model updateDefaultSearchField(array $args = array()) {@command CloudSearch UpdateDefaultSearchField}
* @method Model updateServiceAccessPolicies(array $args = array()) {@command CloudSearch UpdateServiceAccessPolicies}
* @method Model updateStemmingOptions(array $args = array()) {@command CloudSearch UpdateStemmingOptions}
* @method Model updateStopwordOptions(array $args = array()) {@command CloudSearch UpdateStopwordOptions}
* @method Model updateSynonymOptions(array $args = array()) {@command CloudSearch UpdateSynonymOptions}
* @method ResourceIteratorInterface getDescribeDomainsIterator(array $args = array()) The input array uses the parameters of the DescribeDomains operation
* @method ResourceIteratorInterface getDescribeIndexFieldsIterator(array $args = array()) The input array uses the parameters of the DescribeIndexFields operation
* @method ResourceIteratorInterface getDescribeRankExpressionsIterator(array $args = array()) The input array uses the parameters of the DescribeRankExpressions operation
*
* @link http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/service-cloudsearch.html User guide
* @link http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.CloudSearch.CloudSearchClient.html API docs
*/
class CloudSearchClient extends AbstractClient
{
const LATEST_API_VERSION = '2011-02-01';
/**
* Factory method to create a new Amazon CloudSearch client using an array of configuration options.
*
* The following array keys and values are available options:
*
* - Credential options (`key`, `secret`, and optional `token` OR `credentials` is required)
* - key: AWS Access Key ID
* - secret: AWS secret access key
* - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
* - token: Custom AWS security token to use with request authentication
* - token.ttd: UNIX timestamp for when the custom credentials expire
* - credentials.cache.key: Optional custom cache key to use with the credentials
* - Region and Endpoint options (a `region` and optional `scheme` OR a `base_url` is required)
* - region: Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
* - scheme: URI Scheme of the base URL (e.g. 'https', 'http').
* - base_url: Instead of using a `region` and `scheme`, you can specify a custom base URL for the client
* - endpoint_provider: Optional `Aws\Common\Region\EndpointProviderInterface` used to provide region endpoints
* - Generic client options
* - ssl.cert: Set to true to use the bundled CA cert or pass the full path to an SSL certificate bundle. This
* option should be used when you encounter curl error code 60.
* - curl.CURLOPT_VERBOSE: Set to true to output curl debug information during transfers
* - curl.*: Prefix any available cURL option with `curl.` to add cURL options to each request.
* See: http://www.php.net/manual/en/function.curl-setopt.php
* - Signature options
* - signature: You can optionally provide a custom signature implementation used to sign requests
* - signature.service: Set to explicitly override the service name used in signatures
* - signature.region: Set to explicitly override the region name used in signatures
* - Exponential backoff options
* - client.backoff.logger: `Guzzle\Common\Log\LogAdapterInterface` object used to log backoff retries. Use
* 'debug' to emit PHP warnings when a retry is issued.
* - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See
* `Guzzle\Http\Plugin\ExponentialBackoffLogger` for formatting information.
*
* @param array|Collection $config Client configuration data
*
* @return self
*/
public static function factory($config = array())
{
return ClientBuilder::factory(__NAMESPACE__)
->setConfig($config)
->setConfigDefaults(array(
Options::VERSION => self::LATEST_API_VERSION,
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/cloudsearch-%s.php'
))
->build();
}
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable IndexFieldType values
*/
class IndexFieldType extends Enum
{
const UINT = 'uint';
const LITERAL = 'literal';
const TEXT = 'text';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable OptionState values
*/
class OptionState extends Enum
{
const REQUIRES_INDEX_DOCUMENTS = 'RequiresIndexDocuments';
const PROCESSING = 'Processing';
const ACTIVE = 'Active';
}

View File

@ -0,0 +1,30 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable SearchInstanceType values
*/
class SearchInstanceType extends Enum
{
const SEARCH_INSTANCET1_MICRO = 'SearchInstance:t1.micro';
const SEARCH_INSTANCEM1_SMALL = 'SearchInstance:m1.small';
const SEARCH_INSTANCEM1_LARGE = 'SearchInstance:m1.large';
const SEARCH_INSTANCEM2_XLARGE = 'SearchInstance:m2.xlarge';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable SourceDataFunction values
*/
class SourceDataFunction extends Enum
{
const COPY = 'Copy';
const TRIM_TITLE = 'TrimTitle';
const MAP = 'Map';
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Exception;
/**
* An error occurred while processing the request.
*/
class BaseException extends CloudSearchException {}

View File

@ -0,0 +1,24 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Exception;
use Aws\Common\Exception\ServiceResponseException;
/**
* Default service exception class
*/
class CloudSearchException extends ServiceResponseException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Exception;
/**
* An internal error occurred while processing the request. If this problem persists, report an issue from the Service Health Dashboard.
*/
class InternalException extends CloudSearchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Exception;
/**
* The request was rejected because it specified an invalid type definition.
*/
class InvalidTypeException extends CloudSearchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Exception;
/**
* The request was rejected because a resource limit has already been met.
*/
class LimitExceededException extends CloudSearchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudSearch\Exception;
/**
* The request was rejected because it attempted to reference a resource that does not exist.
*/
class ResourceNotFoundException extends CloudSearchException {}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch;
use Aws\Common\Client\AbstractClient;
use Aws\Common\Client\ClientBuilder;
use Aws\Common\Enum\ClientOptions as Options;
use Guzzle\Common\Collection;
use Guzzle\Service\Resource\Model;
use Guzzle\Service\Resource\ResourceIteratorInterface;
/**
* Client to interact with Amazon CloudWatch
*
* @method Model deleteAlarms(array $args = array()) {@command CloudWatch DeleteAlarms}
* @method Model describeAlarmHistory(array $args = array()) {@command CloudWatch DescribeAlarmHistory}
* @method Model describeAlarms(array $args = array()) {@command CloudWatch DescribeAlarms}
* @method Model describeAlarmsForMetric(array $args = array()) {@command CloudWatch DescribeAlarmsForMetric}
* @method Model disableAlarmActions(array $args = array()) {@command CloudWatch DisableAlarmActions}
* @method Model enableAlarmActions(array $args = array()) {@command CloudWatch EnableAlarmActions}
* @method Model getMetricStatistics(array $args = array()) {@command CloudWatch GetMetricStatistics}
* @method Model listMetrics(array $args = array()) {@command CloudWatch ListMetrics}
* @method Model putMetricAlarm(array $args = array()) {@command CloudWatch PutMetricAlarm}
* @method Model putMetricData(array $args = array()) {@command CloudWatch PutMetricData}
* @method Model setAlarmState(array $args = array()) {@command CloudWatch SetAlarmState}
* @method ResourceIteratorInterface getDescribeAlarmHistoryIterator(array $args = array()) The input array uses the parameters of the DescribeAlarmHistory operation
* @method ResourceIteratorInterface getDescribeAlarmsIterator(array $args = array()) The input array uses the parameters of the DescribeAlarms operation
* @method ResourceIteratorInterface getDescribeAlarmsForMetricIterator(array $args = array()) The input array uses the parameters of the DescribeAlarmsForMetric operation
* @method ResourceIteratorInterface getListMetricsIterator(array $args = array()) The input array uses the parameters of the ListMetrics operation
*
* @link http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/service-cloudwatch.html User guide
* @link http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.CloudWatch.CloudWatchClient.html API docs
*/
class CloudWatchClient extends AbstractClient
{
const LATEST_API_VERSION = '2010-08-01';
/**
* Factory method to create a new Amazon CloudWatch client using an array of configuration options.
*
* The following array keys and values are available options:
*
* - Credential options (`key`, `secret`, and optional `token` OR `credentials` is required)
* - key: AWS Access Key ID
* - secret: AWS secret access key
* - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
* - token: Custom AWS security token to use with request authentication
* - token.ttd: UNIX timestamp for when the custom credentials expire
* - credentials.cache.key: Optional custom cache key to use with the credentials
* - Region and Endpoint options (a `region` and optional `scheme` OR a `base_url` is required)
* - region: Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
* - scheme: URI Scheme of the base URL (e.g. 'https', 'http').
* - base_url: Instead of using a `region` and `scheme`, you can specify a custom base URL for the client
* - Generic client options
* - ssl.cert: Set to true to use the bundled CA cert or pass the full path to an SSL certificate bundle. This
* option should be used when you encounter curl error code 60.
* - curl.CURLOPT_VERBOSE: Set to true to output curl debug information during transfers
* - curl.*: Prefix any available cURL option with `curl.` to add cURL options to each request.
* See: http://www.php.net/manual/en/function.curl-setopt.php
* - service.description.cache.ttl: Optional TTL used for the service description cache
* - Signature options
* - signature: You can optionally provide a custom signature implementation used to sign requests
* - signature.service: Set to explicitly override the service name used in signatures
* - signature.region: Set to explicitly override the region name used in signatures
* - Exponential backoff options
* - client.backoff.logger: `Guzzle\Common\Log\LogAdapterInterface` object used to log backoff retries. Use
* 'debug' to emit PHP warnings when a retry is issued.
* - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See
* `Guzzle\Http\Plugin\ExponentialBackoffLogger` for formatting information.
*
* @param array|Collection $config Client configuration data
*
* @return self
*/
public static function factory($config = array())
{
return ClientBuilder::factory(__NAMESPACE__)
->setConfig($config)
->setConfigDefaults(array(
Options::VERSION => self::LATEST_API_VERSION,
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/cloudwatch-%s.php'
))
->build();
}
}

View File

@ -0,0 +1,30 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable ComparisonOperator values
*/
class ComparisonOperator extends Enum
{
const GREATER_THAN_OR_EQUAL_TO_THRESHOLD = 'GreaterThanOrEqualToThreshold';
const GREATER_THAN_THRESHOLD = 'GreaterThanThreshold';
const LESS_THAN_THRESHOLD = 'LessThanThreshold';
const LESS_THAN_OR_EQUAL_TO_THRESHOLD = 'LessThanOrEqualToThreshold';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable HistoryItemType values
*/
class HistoryItemType extends Enum
{
const CONFIGURATION_UPDATE = 'ConfigurationUpdate';
const STATE_UPDATE = 'StateUpdate';
const ACTION = 'Action';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable StateValue values
*/
class StateValue extends Enum
{
const OK = 'OK';
const ALARM = 'ALARM';
const INSUFFICIENT_DATA = 'INSUFFICIENT_DATA';
}

View File

@ -0,0 +1,31 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable Statistic values
*/
class Statistic extends Enum
{
const SAMPLE_COUNT = 'SampleCount';
const AVERAGE = 'Average';
const SUM = 'Sum';
const MINIMUM = 'Minimum';
const MAXIMUM = 'Maximum';
}

View File

@ -0,0 +1,53 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Enum;
use Aws\Common\Enum;
/**
* Contains enumerable Unit values
*/
class Unit extends Enum
{
const SECONDS = 'Seconds';
const MICROSECONDS = 'Microseconds';
const MILLISECONDS = 'Milliseconds';
const BYTES = 'Bytes';
const KILOBYTES = 'Kilobytes';
const MEGABYTES = 'Megabytes';
const GIGABYTES = 'Gigabytes';
const TERABYTES = 'Terabytes';
const BITS = 'Bits';
const KILOBITS = 'Kilobits';
const MEGABITS = 'Megabits';
const GIGABITS = 'Gigabits';
const TERABITS = 'Terabits';
const PERCENT = 'Percent';
const COUNT = 'Count';
const BYTES_PER_SECOND = 'Bytes/Second';
const KILOBYTES_PER_SECOND = 'Kilobytes/Second';
const MEGABYTES_PER_SECOND = 'Megabytes/Second';
const GIGABYTES_PER_SECOND = 'Gigabytes/Second';
const TERABYTES_PER_SECOND = 'Terabytes/Second';
const BITS_PER_SECOND = 'Bits/Second';
const KILOBITS_PER_SECOND = 'Kilobits/Second';
const MEGABITS_PER_SECOND = 'Megabits/Second';
const GIGABITS_PER_SECOND = 'Gigabits/Second';
const TERABITS_PER_SECOND = 'Terabits/Second';
const COUNT_PER_SECOND = 'Count/Second';
const NONE = 'None';
}

View File

@ -0,0 +1,24 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
use Aws\Common\Exception\ServiceResponseException;
/**
* Default service exception class
*/
class CloudWatchException extends ServiceResponseException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* Indicates that the request processing has failed due to some unknown error, exception, or failure.
*/
class InternalServiceException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* Data was not syntactically valid JSON.
*/
class InvalidFormatException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* The next token specified is invalid.
*/
class InvalidNextTokenException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* Parameters that must not be used together were used together.
*/
class InvalidParameterCombinationException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* Bad or out-of-range value was supplied for the input parameter.
*/
class InvalidParameterValueException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* The quota for alarms for this customer has already been reached.
*/
class LimitExceededException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* An input parameter that is mandatory for processing the request is not supplied.
*/
class MissingRequiredParameterException extends CloudWatchException {}

View File

@ -0,0 +1,22 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\CloudWatch\Exception;
/**
* The named resource does not exist.
*/
class ResourceNotFoundException extends CloudWatchException {}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,107 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common;
use Guzzle\Service\Builder\ServiceBuilder;
use Guzzle\Service\Builder\ServiceBuilderLoader;
/**
* Base class for interacting with web service clients
*/
class Aws extends ServiceBuilder
{
/**
* @var string Current version of the SDK
*/
const VERSION = '2.4.0';
/**
* Create a new service locator for the AWS SDK
*
* You can configure the service locator is four different ways:
*
* 1. Use the default configuration file shipped with the SDK that wires class names with service short names and
* specify global parameters to add to every definition (e.g. key, secret, credentials, etc)
*
* 2. Use a custom configuration file that extends the default config and supplies credentials for each service.
*
* 3. Use a custom config file that wires services to custom short names for services.
*
* 4. If you are on Amazon EC2, you can use the default configuration file and not provide any credentials so that
* you are using InstanceProfile credentials.
*
* @param array|string $config The full path to a .php or .js|.json file, or an associative array of data
* to use as global parameters to pass to each service.
* @param array $globalParameters Global parameters to pass to every service as it is instantiated.
*
* @return Aws
*/
public static function factory($config = null, array $globalParameters = array())
{
if (!$config) {
// If nothing is passed in, then use the default configuration file with credentials from the environment
$config = self::getDefaultServiceDefinition();
} elseif (is_array($config)) {
// If an array was passed, then use the default configuration file with parameter overrides
$globalParameters = $config;
$config = self::getDefaultServiceDefinition();
}
$loader = new ServiceBuilderLoader();
$loader->addAlias('_aws', self::getDefaultServiceDefinition())
->addAlias('_sdk1', __DIR__ . '/Resources/sdk1-config.php');
return $loader->load($config, $globalParameters);
}
/**
* Get the full path to the default service builder definition file
*
* @return string
*/
public static function getDefaultServiceDefinition()
{
return __DIR__ . '/Resources/aws-config.php';
}
/**
* Returns the configuration for the service builder
*
* @return array
*/
public function getConfig()
{
return $this->builderConfig;
}
/**
* Enables the facades for the clients defined in the service builder
*
* @param string|null $namespace The namespace that the facades should be mounted to. Defaults to global namespace
*
* @return Aws
*/
public function enableFacades($namespace = null)
{
$facadeClass = 'Aws\\Common\\Facade\\Facade';
if (class_exists($facadeClass)) {
$facadeClass::mountFacades($this, $namespace);
}
return $this;
}
}

View File

@ -0,0 +1,273 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Client;
use Aws\Common\Aws;
use Aws\Common\Credentials\Credentials;
use Aws\Common\Credentials\CredentialsInterface;
use Aws\Common\Enum\ClientOptions as Options;
use Aws\Common\Exception\InvalidArgumentException;
use Aws\Common\Signature\EndpointSignatureInterface;
use Aws\Common\Signature\SignatureInterface;
use Aws\Common\Signature\SignatureListener;
use Aws\Common\Waiter\WaiterClassFactory;
use Aws\Common\Waiter\CompositeWaiterFactory;
use Aws\Common\Waiter\WaiterFactoryInterface;
use Aws\Common\Waiter\WaiterConfigFactory;
use Guzzle\Common\Collection;
use Guzzle\Service\Client;
use Guzzle\Service\Description\ServiceDescriptionInterface;
/**
* Abstract AWS client
*/
abstract class AbstractClient extends Client implements AwsClientInterface
{
/**
* @var CredentialsInterface AWS credentials
*/
protected $credentials;
/**
* @var SignatureInterface Signature implementation of the service
*/
protected $signature;
/**
* @var WaiterFactoryInterface Factory used to create waiter classes
*/
protected $waiterFactory;
/**
* {@inheritdoc}
*/
public static function getAllEvents()
{
return array_merge(Client::getAllEvents(), array(
'client.region_changed',
'client.credentials_changed',
));
}
/**
* @param CredentialsInterface $credentials AWS credentials
* @param SignatureInterface $signature Signature implementation
* @param Collection $config Configuration options
*
* @throws InvalidArgumentException if an endpoint provider isn't provided
*/
public function __construct(CredentialsInterface $credentials, SignatureInterface $signature, Collection $config)
{
// Bootstrap with Guzzle
parent::__construct($config->get(Options::BASE_URL), $config);
$this->credentials = $credentials;
$this->signature = $signature;
// Make sure the user agent is prefixed by the SDK version
$this->setUserAgent('aws-sdk-php2/' . Aws::VERSION, true);
// Add the event listener so that requests are signed before they are sent
$dispatcher = $this->getEventDispatcher();
$dispatcher->addSubscriber(new SignatureListener($credentials, $signature));
if ($backoff = $config->get(Options::BACKOFF)) {
$dispatcher->addSubscriber($backoff, -255);
}
}
public function __call($method, $args)
{
if (substr($method, 0, 3) === 'get' && substr($method, -8) === 'Iterator') {
// Allow magic method calls for iterators (e.g. $client->get<CommandName>Iterator($params))
$commandOptions = isset($args[0]) ? $args[0] : null;
$iteratorOptions = isset($args[1]) ? $args[1] : array();
return $this->getIterator(substr($method, 3, -8), $commandOptions, $iteratorOptions);
} elseif (substr($method, 0, 9) == 'waitUntil') {
// Allow magic method calls for waiters (e.g. $client->waitUntil<WaiterName>($params))
return $this->waitUntil(substr($method, 9), isset($args[0]) ? $args[0]: array());
} else {
return parent::__call(ucfirst($method), $args);
}
}
/**
* Get an endpoint for a specific region from a service description
*
* @param ServiceDescriptionInterface $description Service description
* @param string $region Region of the endpoint
* @param string $scheme URL scheme
*
* @return string
* @throws InvalidArgumentException
*/
public static function getEndpoint(ServiceDescriptionInterface $description, $region, $scheme)
{
$service = $description->getData('serviceFullName');
// Lookup the region in the service description
if (!($regions = $description->getData('regions'))) {
throw new InvalidArgumentException("No regions found in the {$service} description");
}
// Ensure that the region exists for the service
if (!isset($regions[$region])) {
throw new InvalidArgumentException("{$region} is not a valid region for {$service}");
}
// Ensure that the scheme is valid
if ($regions[$region][$scheme] == false) {
throw new InvalidArgumentException("{$scheme} is not a valid URI scheme for {$service} in {$region}");
}
return $scheme . '://' . $regions[$region]['hostname'];
}
/**
* {@inheritdoc}
*/
public function getCredentials()
{
return $this->credentials;
}
/**
* {@inheritdoc}
*/
public function setCredentials(CredentialsInterface $credentials)
{
$formerCredentials = $this->credentials;
$this->credentials = $credentials;
// Dispatch an event that the credentials have been changed
$this->dispatch('client.credentials_changed', array(
'credentials' => $credentials,
'former_credentials' => $formerCredentials,
));
return $this;
}
/**
* {@inheritdoc}
*/
public function getSignature()
{
return $this->signature;
}
/**
* {@inheritdoc}
*/
public function getRegions()
{
return $this->serviceDescription->getData('regions');
}
/**
* {@inheritdoc}
*/
public function getRegion()
{
return $this->getConfig(Options::REGION);
}
/**
* {@inheritdoc}
*/
public function setRegion($region)
{
$config = $this->getConfig();
$formerRegion = $config->get(Options::REGION);
$global = $this->serviceDescription->getData('globalEndpoint');
// Only change the region if the service does not have a global endpoint
if (!$global || $this->serviceDescription->getData('namespace') === 'S3') {
$baseUrl = self::getEndpoint($this->serviceDescription, $region, $config->get(Options::SCHEME));
$this->setBaseUrl($baseUrl);
$config->set(Options::BASE_URL, $baseUrl)->set(Options::REGION, $region);
// Update the signature if necessary
$signature = $this->getSignature();
if ($signature instanceof EndpointSignatureInterface) {
/** @var $signature EndpointSignatureInterface */
$signature->setRegionName($region);
}
// Dispatch an event that the region has been changed
$this->dispatch('client.region_changed', array(
'region' => $region,
'former_region' => $formerRegion,
));
}
return $this;
}
/**
* {@inheritdoc}
*/
public function waitUntil($waiter, array $input = array())
{
$this->getWaiter($waiter, $input)->wait();
return $this;
}
/**
* {@inheritdoc}
*/
public function getWaiter($waiter, array $input = array())
{
return $this->getWaiterFactory()->build($waiter)
->setClient($this)
->setConfig($input);
}
/**
* {@inheritdoc}
*/
public function setWaiterFactory(WaiterFactoryInterface $waiterFactory)
{
$this->waiterFactory = $waiterFactory;
return $this;
}
/**
* {@inheritdoc}
*/
public function getWaiterFactory()
{
if (!$this->waiterFactory) {
$clientClass = get_class($this);
// Use a composite factory that checks for classes first, then config waiters
$this->waiterFactory = new CompositeWaiterFactory(array(
new WaiterClassFactory(substr($clientClass, 0, strrpos($clientClass, '\\')) . '\\Waiter')
));
if ($this->getDescription()) {
$this->waiterFactory->addFactory(new WaiterConfigFactory($this->getDescription()->getData('waiters')));
}
}
return $this->waiterFactory;
}
/**
* {@inheritdoc}
*/
public function getApiVersion()
{
return $this->serviceDescription->getApiVersion();
}
}

View File

@ -0,0 +1,118 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Client;
use Aws\Common\Credentials\CredentialsInterface;
use Aws\Common\Signature\SignatureInterface;
use Aws\Common\Waiter\WaiterFactoryInterface;
use Aws\Common\Waiter\WaiterInterface;
use Guzzle\Service\ClientInterface;
/**
* Interface that all AWS clients implement
*/
interface AwsClientInterface extends ClientInterface
{
/**
* Returns the AWS credentials associated with the client
*
* @return CredentialsInterface
*/
public function getCredentials();
/**
* Sets the credentials object associated with the client
*
* @param CredentialsInterface $credentials Credentials object to use
*
* @return self
*/
public function setCredentials(CredentialsInterface $credentials);
/**
* Returns the signature implementation used with the client
*
* @return SignatureInterface
*/
public function getSignature();
/**
* Get a list of available regions and region data
*
* @return array
*/
public function getRegions();
/**
* Get the name of the region to which the client is configured to send requests
*
* @return string
*/
public function getRegion();
/**
* Change the region to which the client is configured to send requests
*
* @param string $region Name of the region
*
* @return self
*/
public function setRegion($region);
/**
* Get the waiter factory being used by the client
*
* @return WaiterFactoryInterface
*/
public function getWaiterFactory();
/**
* Set the waiter factory to use with the client
*
* @param WaiterFactoryInterface $waiterFactory Factory used to create waiters
*
* @return self
*/
public function setWaiterFactory(WaiterFactoryInterface $waiterFactory);
/**
* Wait until a resource is available or an associated waiter returns true
*
* @param string $waiter Name of the waiter
* @param array $input Values used as input for the underlying operation and to control the waiter
*
* @return self
*/
public function waitUntil($waiter, array $input = array());
/**
* Get a named waiter object
*
* @param string $waiter Name of the waiter
* @param array $input Values used as input for the underlying operation and to control the waiter
*
* @return WaiterInterface
*/
public function getWaiter($waiter, array $input = array());
/**
* Get the API version of the client (e.g. 2006-03-01)
*
* @return string
*/
public function getApiVersion();
}

View File

@ -0,0 +1,454 @@
<?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Client;
use Aws\Common\Credentials\Credentials;
use Aws\Common\Enum\ClientOptions as Options;
use Aws\Common\Enum\Region;
use Aws\Common\Exception\ExceptionListener;
use Aws\Common\Exception\InvalidArgumentException;
use Aws\Common\Exception\NamespaceExceptionFactory;
use Aws\Common\Exception\Parser\DefaultXmlExceptionParser;
use Aws\Common\Exception\Parser\ExceptionParserInterface;
use Aws\Common\Iterator\AwsResourceIteratorFactory;
use Aws\Common\Signature\EndpointSignatureInterface;
use Aws\Common\Signature\SignatureInterface;
use Aws\Common\Signature\SignatureV2;
use Aws\Common\Signature\SignatureV3;
use Aws\Common\Signature\SignatureV3Https;
use Aws\Common\Signature\SignatureV4;
use Guzzle\Common\Collection;
use Guzzle\Plugin\Backoff\BackoffPlugin;
use Guzzle\Plugin\Backoff\CurlBackoffStrategy;
use Guzzle\Plugin\Backoff\ExponentialBackoffStrategy;
use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
use Guzzle\Plugin\Backoff\TruncatedBackoffStrategy;
use Guzzle\Service\Client;
use Guzzle\Service\Description\ServiceDescription;
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
use Guzzle\Log\LogAdapterInterface;
use Guzzle\Log\ClosureLogAdapter;
use Guzzle\Plugin\Backoff\BackoffLogger;
/**
* Builder for creating AWS service clients
*/
class ClientBuilder
{
/**
* @var array Default client config
*/
protected static $commonConfigDefaults = array('scheme' => 'https');
/**
* @var array Default client requirements
*/
protected static $commonConfigRequirements = array(Options::SERVICE_DESCRIPTION);
/**
* @var string The namespace of the client
*/
protected $clientNamespace;
/**
* @var array The config options
*/
protected $config = array();
/**
* @var array The config defaults
*/
protected $configDefaults = array();
/**
* @var array The config requirements
*/
protected $configRequirements = array();
/**
* @var ExceptionParserInterface The Parser interface for the client
*/
protected $exceptionParser;
/**
* @var array Array of configuration data for iterators available for the client
*/
protected $iteratorsConfig = array();
/**
* Factory method for creating the client builder
*
* @param string $namespace The namespace of the client
*
* @return ClientBuilder
*/
public static function factory($namespace = null)
{
return new static($namespace);
}
/**
* Constructs a client builder
*
* @param string $namespace The namespace of the client
*/
public function __construct($namespace = null)
{
$this->clientNamespace = $namespace;
}
/**
* Sets the config options
*
* @param array|Collection $config The config options
*
* @return ClientBuilder
*/
public function setConfig($config)
{
$this->config = $this->processArray($config);
return $this;
}
/**
* Sets the config options' defaults
*
* @param array|Collection $defaults The default values
*
* @return ClientBuilder
*/
public function setConfigDefaults($defaults)
{
$this->configDefaults = $this->processArray($defaults);
return $this;
}
/**
* Sets the required config options
*
* @param array|Collection $required The required config options
*
* @return ClientBuilder
*/
public function setConfigRequirements($required)
{
$this->configRequirements = $this->processArray($required);
return $this;
}
/**
* Sets the exception parser. If one is not provided the builder will use
* the default XML exception parser.
*
* @param ExceptionParserInterface $parser The exception parser
*
* @return ClientBuilder
*/
public function setExceptionParser(ExceptionParserInterface $parser)
{
$this->exceptionParser = $parser;
return $this;
}
/**
* Set the configuration for the client's iterators
*
* @param array $config Configuration data for client's iterators
*
* @return ClientBuilder
*/
public function setIteratorsConfig(array $config)
{
$this->iteratorsConfig = $config;
return $this;
}
/**
* Performs the building logic using all of the parameters that have been
* set and falling back to default values. Returns an instantiate service
* client with credentials prepared and plugins attached.
*
* @return AwsClientInterface
* @throws InvalidArgumentException
*/
public function build()
{
// Resolve configuration
$config = Collection::fromConfig(
$this->config,
array_merge(self::$commonConfigDefaults, $this->configDefaults),
(self::$commonConfigRequirements + $this->configRequirements)
);
// Resolve endpoint and signature from the config and service description
$description = $this->updateConfigFromDescription($config);
$signature = $this->getSignature($description, $config);
// Resolve credentials
if (!$credentials = $config->get('credentials')) {
$credentials = Credentials::factory($config);
}
// Resolve exception parser
if (!$this->exceptionParser) {
$this->exceptionParser = new DefaultXmlExceptionParser();
}
// Resolve backoff strategy
$backoff = $config->get(Options::BACKOFF);
if ($backoff === null) {
$backoff = new BackoffPlugin(
// Retry failed requests up to 3 times if it is determined that the request can be retried
new TruncatedBackoffStrategy(3,
// Retry failed requests with 400-level responses due to throttling
new ThrottlingErrorChecker($this->exceptionParser,
// Retry failed requests with 500-level responses
new HttpBackoffStrategy(array(500, 503, 509),
// Retry failed requests due to transient network or cURL problems
new CurlBackoffStrategy(null,
// Retry requests that failed due to expired credentials
new ExpiredCredentialsChecker($this->exceptionParser,
new ExponentialBackoffStrategy()
)
)
)
)
)
);
$config->set(Options::BACKOFF, $backoff);
}
if ($backoff) {
$this->addBackoffLogger($backoff, $config);
}
// Determine service and class name
$clientClass = 'Aws\Common\Client\DefaultClient';
if ($this->clientNamespace) {
$serviceName = substr($this->clientNamespace, strrpos($this->clientNamespace, '\\') + 1);
$clientClass = $this->clientNamespace . '\\' . $serviceName . 'Client';
}
/** @var $client AwsClientInterface */
$client = new $clientClass($credentials, $signature, $config);
$client->setDescription($description);
// Add exception marshaling so that more descriptive exception are thrown
if ($this->clientNamespace) {
$exceptionFactory = new NamespaceExceptionFactory(
$this->exceptionParser,
"{$this->clientNamespace}\\Exception",
"{$this->clientNamespace}\\Exception\\{$serviceName}Exception"
);
$client->addSubscriber(new ExceptionListener($exceptionFactory));
}
// Add the UserAgentPlugin to append to the User-Agent header of requests
$client->addSubscriber(new UserAgentListener());
// Filters used for the cache plugin
$client->getConfig()->set(
'params.cache.key_filter',
'header=date,x-amz-date,x-amz-security-token,x-amzn-authorization'
);
// Set the iterator resource factory based on the provided iterators config
$client->setResourceIteratorFactory(new AwsResourceIteratorFactory(
$this->iteratorsConfig,
new ResourceIteratorClassFactory($this->clientNamespace . '\\Iterator')
));
// Disable parameter validation if needed
if ($config->get(Options::VALIDATION) === false) {
$params = $config->get('command.params') ?: array();
$params['command.disable_validation'] = true;
$config->set('command.params', $params);
}
return $client;
}
/**
* Add backoff logging to the backoff plugin if needed
*
* @param BackoffPlugin $plugin Backoff plugin
* @param Collection $config Configuration settings
*
* @throws InvalidArgumentException
*/
protected function addBackoffLogger(BackoffPlugin $plugin, Collection $config)
{
// The log option can be set to `debug` or an instance of a LogAdapterInterface
if ($logger = $config->get(Options::BACKOFF_LOGGER)) {
$format = $config->get(Options::BACKOFF_LOGGER_TEMPLATE);
if ($logger === 'debug') {
$logger = new ClosureLogAdapter(function ($message) {
trigger_error($message . "\n");
});
} elseif (!($logger instanceof LogAdapterInterface)) {
throw new InvalidArgumentException(
Options::BACKOFF_LOGGER . ' must be set to `debug` or an instance of '
. 'Guzzle\\Common\\Log\\LogAdapterInterface'
);
}
// Create the plugin responsible for logging exponential backoff retries
$logPlugin = new BackoffLogger($logger);
// You can specify a custom format or use the default
if ($format) {
$logPlugin->setTemplate($format);
}
$plugin->addSubscriber($logPlugin);
}
}
/**
* Ensures that an array (e.g. for config data) is actually in array form
*
* @param array|Collection $array The array data
*
* @return array
* @throws InvalidArgumentException if the arg is not an array or Collection
*/
protected function processArray($array)
{
if ($array instanceof Collection) {
$array = $array->getAll();
}
if (!is_array($array)) {
throw new InvalidArgumentException('The config must be provided as an array or Collection.');
}
return $array;
}
/**
* Update a configuration object from a service description
*
* @param Collection $config Config to update
*
* @return ServiceDescription
* @throws InvalidArgumentException
*/
protected function updateConfigFromDescription(Collection $config)
{
$description = $config->get(Options::SERVICE_DESCRIPTION);
if (!($description instanceof ServiceDescription)) {
// Inject the version into the sprintf template if it is a string
if (is_string($description)) {
$description = sprintf($description, $config->get(Options::VERSION));
}
$description = ServiceDescription::factory($description);
$config->set(Options::SERVICE_DESCRIPTION, $description);
}
if (!$config->get(Options::SERVICE)) {
$config->set(Options::SERVICE, $description->getData('endpointPrefix'));
}
if ($iterators = $description->getData('iterators')) {
$this->setIteratorsConfig($iterators);
}
// Ensure that the service description has regions
if (!$description->getData('regions')) {
throw new InvalidArgumentException(
'No regions found in the ' . $description->getData('serviceFullName'). ' description'
);
}
// Make sure a valid region is set
$region = $config->get(Options::REGION);
$global = $description->getData('globalEndpoint');
if (!$global && !$region) {
throw new InvalidArgumentException(
'A region is required when using ' . $description->getData('serviceFullName')
. '. Set "region" to one of: ' . implode(', ', array_keys($description->getData('regions')))
);
} elseif ($global && (!$region || $description->getData('namespace') !== 'S3')) {
$region = Region::US_EAST_1;
$config->set(Options::REGION, $region);
}
if (!$config->get(Options::BASE_URL)) {
// Set the base URL using the scheme and hostname of the service's region
$config->set(Options::BASE_URL, AbstractClient::getEndpoint(
$description,
$region,
$config->get(Options::SCHEME)
));
}
return $description;
}
/**
* Return an appropriate signature object for a a client based on a description
*
* @param ServiceDescription $description Description that holds a signature option
* @param Collection $config Configuration options
*
* @return SignatureInterface
* @throws InvalidArgumentException
*/
protected function getSignature(ServiceDescription $description, Collection $config)
{
if (!$signature = $config->get(Options::SIGNATURE)) {
switch ($description->getData('signatureVersion')) {
case 'v2':
$signature = new SignatureV2();
break;
case 'v3':
$signature = new SignatureV3();
break;
case 'v3https':
$signature = new SignatureV3Https();
break;
case 'v4':
$signature = new SignatureV4();
break;
default:
throw new InvalidArgumentException('Service description does not specify a valid signatureVersion');
}
}
// Allow a custom service name or region value to be provided
if ($signature instanceof EndpointSignatureInterface) {
// Determine the service name to use when signing
if (!$service = $config->get(Options::SIGNATURE_SERVICE)) {
if (!$service = $description->getData('signingName')) {
$service = $description->getData('endpointPrefix');
}
}
$signature->setServiceName($service);
// Determine the region to use when signing requests
if (!$region = $config->get(Options::SIGNATURE_REGION)) {
$region = $config->get(Options::REGION);
}
$signature->setRegionName($region);
}
return $signature;
}
}

Some files were not shown because too many files have changed in this diff Show More