├── .gitignore
├── README.md
├── codeception.yml
├── composer.json
├── image-generator.php
├── includes
├── Aws
│ ├── Api
│ │ ├── AbstractModel.php
│ │ ├── ApiProvider.php
│ │ ├── DateTimeResult.php
│ │ ├── DocModel.php
│ │ ├── ErrorParser
│ │ │ ├── JsonParserTrait.php
│ │ │ ├── JsonRpcErrorParser.php
│ │ │ ├── RestJsonErrorParser.php
│ │ │ └── XmlErrorParser.php
│ │ ├── ListShape.php
│ │ ├── MapShape.php
│ │ ├── Operation.php
│ │ ├── Parser
│ │ │ ├── AbstractParser.php
│ │ │ ├── AbstractRestParser.php
│ │ │ ├── Crc32ValidatingParser.php
│ │ │ ├── JsonParser.php
│ │ │ ├── JsonRpcParser.php
│ │ │ ├── QueryParser.php
│ │ │ ├── RestJsonParser.php
│ │ │ ├── RestXmlParser.php
│ │ │ └── XmlParser.php
│ │ ├── Serializer
│ │ │ ├── Ec2ParamBuilder.php
│ │ │ ├── JsonBody.php
│ │ │ ├── JsonRpcSerializer.php
│ │ │ ├── QueryParamBuilder.php
│ │ │ ├── QuerySerializer.php
│ │ │ ├── RestJsonSerializer.php
│ │ │ ├── RestSerializer.php
│ │ │ ├── RestXmlSerializer.php
│ │ │ └── XmlBody.php
│ │ ├── Service.php
│ │ ├── Shape.php
│ │ ├── ShapeMap.php
│ │ ├── StructureShape.php
│ │ ├── TimestampShape.php
│ │ └── Validator.php
│ ├── AutoScaling
│ │ ├── AutoScalingClient.php
│ │ └── Exception
│ │ │ └── AutoScalingException.php
│ ├── AwsClient.php
│ ├── AwsClientInterface.php
│ ├── CacheInterface.php
│ ├── ClientResolver.php
│ ├── CloudFormation
│ │ ├── CloudFormationClient.php
│ │ └── Exception
│ │ │ └── CloudFormationException.php
│ ├── CloudFront
│ │ ├── CloudFrontClient.php
│ │ ├── Exception
│ │ │ └── CloudFrontException.php
│ │ └── UrlSigner.php
│ ├── CloudHsm
│ │ ├── CloudHsmClient.php
│ │ └── Exception
│ │ │ └── CloudHsmException.php
│ ├── CloudSearch
│ │ ├── CloudSearchClient.php
│ │ └── Exception
│ │ │ └── CloudSearchException.php
│ ├── CloudSearchDomain
│ │ ├── CloudSearchDomainClient.php
│ │ └── Exception
│ │ │ └── CloudSearchDomainException.php
│ ├── CloudTrail
│ │ ├── CloudTrailClient.php
│ │ ├── Exception
│ │ │ └── CloudTrailException.php
│ │ ├── LogFileIterator.php
│ │ ├── LogFileReader.php
│ │ └── LogRecordIterator.php
│ ├── CloudWatch
│ │ ├── CloudWatchClient.php
│ │ └── Exception
│ │ │ └── CloudWatchException.php
│ ├── CloudWatchLogs
│ │ ├── CloudWatchLogsClient.php
│ │ └── Exception
│ │ │ └── CloudWatchLogsException.php
│ ├── CodeCommit
│ │ ├── CodeCommitClient.php
│ │ └── Exception
│ │ │ └── CodeCommitException.php
│ ├── CodeDeploy
│ │ ├── CodeDeployClient.php
│ │ └── Exception
│ │ │ └── CodeDeployException.php
│ ├── CodePipeline
│ │ ├── CodePipelineClient.php
│ │ └── Exception
│ │ │ └── CodePipelineException.php
│ ├── CognitoIdentity
│ │ ├── CognitoIdentityClient.php
│ │ └── Exception
│ │ │ └── CognitoIdentityException.php
│ ├── CognitoSync
│ │ ├── CognitoSyncClient.php
│ │ └── Exception
│ │ │ └── CognitoSyncException.php
│ ├── Command.php
│ ├── CommandInterface.php
│ ├── CommandPool.php
│ ├── ConfigService
│ │ ├── ConfigServiceClient.php
│ │ └── Exception
│ │ │ └── ConfigServiceException.php
│ ├── Credentials
│ │ ├── CredentialProvider.php
│ │ ├── Credentials.php
│ │ ├── CredentialsInterface.php
│ │ └── InstanceProfileProvider.php
│ ├── DataPipeline
│ │ ├── DataPipelineClient.php
│ │ └── Exception
│ │ │ └── DataPipelineException.php
│ ├── DeviceFarm
│ │ ├── DeviceFarmClient.php
│ │ └── Exception
│ │ │ └── DeviceFarmException.php
│ ├── DirectConnect
│ │ ├── DirectConnectClient.php
│ │ └── Exception
│ │ │ └── DirectConnectException.php
│ ├── DirectoryService
│ │ ├── DirectoryServiceClient.php
│ │ └── Exception
│ │ │ └── DirectoryServiceException.php
│ ├── DynamoDb
│ │ ├── BinaryValue.php
│ │ ├── DynamoDbClient.php
│ │ ├── Exception
│ │ │ └── DynamoDbException.php
│ │ ├── LockingSessionConnection.php
│ │ ├── Marshaler.php
│ │ ├── NumberValue.php
│ │ ├── SessionConnectionInterface.php
│ │ ├── SessionHandler.php
│ │ ├── SetValue.php
│ │ ├── StandardSessionConnection.php
│ │ └── WriteRequestBatch.php
│ ├── DynamoDbStreams
│ │ ├── DynamoDbStreamsClient.php
│ │ └── Exception
│ │ │ └── DynamoDbStreamsException.php
│ ├── Ec2
│ │ ├── CopySnapshotMiddleware.php
│ │ ├── Ec2Client.php
│ │ └── Exception
│ │ │ └── Ec2Exception.php
│ ├── Ecs
│ │ ├── EcsClient.php
│ │ └── Exception
│ │ │ └── EcsException.php
│ ├── Efs
│ │ ├── EfsClient.php
│ │ └── Exception
│ │ │ └── EfsException.php
│ ├── ElastiCache
│ │ ├── ElastiCacheClient.php
│ │ └── Exception
│ │ │ └── ElastiCacheException.php
│ ├── ElasticBeanstalk
│ │ ├── ElasticBeanstalkClient.php
│ │ └── Exception
│ │ │ └── ElasticBeanstalkException.php
│ ├── ElasticLoadBalancing
│ │ ├── ElasticLoadBalancingClient.php
│ │ └── Exception
│ │ │ └── ElasticLoadBalancingException.php
│ ├── ElasticTranscoder
│ │ ├── ElasticTranscoderClient.php
│ │ └── Exception
│ │ │ └── ElasticTranscoderException.php
│ ├── Emr
│ │ ├── EmrClient.php
│ │ └── Exception
│ │ │ └── EmrException.php
│ ├── Endpoint
│ │ ├── EndpointProvider.php
│ │ └── PatternEndpointProvider.php
│ ├── Exception
│ │ ├── AwsException.php
│ │ ├── CouldNotCreateChecksumException.php
│ │ ├── CredentialsException.php
│ │ ├── MultipartUploadException.php
│ │ ├── UnresolvedApiException.php
│ │ ├── UnresolvedEndpointException.php
│ │ └── UnresolvedSignatureException.php
│ ├── Glacier
│ │ ├── Exception
│ │ │ └── GlacierException.php
│ │ ├── GlacierClient.php
│ │ ├── MultipartUploader.php
│ │ └── TreeHash.php
│ ├── Handler
│ │ ├── GuzzleV5
│ │ │ ├── GuzzleHandler.php
│ │ │ ├── GuzzleStream.php
│ │ │ └── PsrStream.php
│ │ └── GuzzleV6
│ │ │ └── GuzzleHandler.php
│ ├── HandlerList.php
│ ├── HasDataTrait.php
│ ├── HashInterface.php
│ ├── HashingStream.php
│ ├── History.php
│ ├── Iam
│ │ ├── Exception
│ │ │ └── IamException.php
│ │ └── IamClient.php
│ ├── JsonCompiler.php
│ ├── Kinesis
│ │ ├── Exception
│ │ │ └── KinesisException.php
│ │ └── KinesisClient.php
│ ├── Kms
│ │ ├── Exception
│ │ │ └── KmsException.php
│ │ └── KmsClient.php
│ ├── Lambda
│ │ ├── Exception
│ │ │ └── LambdaException.php
│ │ └── LambdaClient.php
│ ├── LruArrayCache.php
│ ├── MachineLearning
│ │ ├── Exception
│ │ │ └── MachineLearningException.php
│ │ └── MachineLearningClient.php
│ ├── Middleware.php
│ ├── MockHandler.php
│ ├── Multipart
│ │ ├── AbstractUploader.php
│ │ └── UploadState.php
│ ├── OpsWorks
│ │ ├── Exception
│ │ │ └── OpsWorksException.php
│ │ └── OpsWorksClient.php
│ ├── PhpHash.php
│ ├── Rds
│ │ ├── Exception
│ │ │ └── RdsException.php
│ │ └── RdsClient.php
│ ├── Redshift
│ │ ├── Exception
│ │ │ └── RedshiftException.php
│ │ └── RedshiftClient.php
│ ├── Result.php
│ ├── ResultInterface.php
│ ├── ResultPaginator.php
│ ├── RetryMiddleware.php
│ ├── Route53
│ │ ├── Exception
│ │ │ └── Route53Exception.php
│ │ └── Route53Client.php
│ ├── Route53Domains
│ │ ├── Exception
│ │ │ └── Route53DomainsException.php
│ │ └── Route53DomainsClient.php
│ ├── S3
│ │ ├── ApplyChecksumMiddleware.php
│ │ ├── ApplyMd5Middleware.php
│ │ ├── BatchDelete.php
│ │ ├── BucketEndpointMiddleware.php
│ │ ├── Exception
│ │ │ ├── DeleteMultipleObjectsException.php
│ │ │ ├── PermanentRedirectException.php
│ │ │ └── S3Exception.php
│ │ ├── GetBucketLocationParser.php
│ │ ├── MultipartUploader.php
│ │ ├── PermanentRedirectMiddleware.php
│ │ ├── PostObject.php
│ │ ├── PutObjectUrlMiddleware.php
│ │ ├── S3Client.php
│ │ ├── S3UriParser.php
│ │ ├── SSECMiddleware.php
│ │ ├── StreamWrapper.php
│ │ └── Transfer.php
│ ├── Sdk.php
│ ├── Ses
│ │ ├── Exception
│ │ │ └── SesException.php
│ │ └── SesClient.php
│ ├── Signature
│ │ ├── AnonymousSignature.php
│ │ ├── S3SignatureV4.php
│ │ ├── SignatureInterface.php
│ │ ├── SignatureProvider.php
│ │ └── SignatureV4.php
│ ├── Sns
│ │ ├── Exception
│ │ │ ├── MessageValidatorException.php
│ │ │ └── SnsException.php
│ │ ├── MessageValidator
│ │ │ ├── Message.php
│ │ │ └── MessageValidator.php
│ │ └── SnsClient.php
│ ├── Sqs
│ │ ├── Exception
│ │ │ └── SqsException.php
│ │ └── SqsClient.php
│ ├── Ssm
│ │ ├── Exception
│ │ │ └── SsmException.php
│ │ └── SsmClient.php
│ ├── StorageGateway
│ │ ├── Exception
│ │ │ └── StorageGatewayException.php
│ │ └── StorageGatewayClient.php
│ ├── Sts
│ │ ├── Exception
│ │ │ └── StsException.php
│ │ └── StsClient.php
│ ├── Support
│ │ ├── Exception
│ │ │ └── SupportException.php
│ │ └── SupportClient.php
│ ├── Swf
│ │ ├── Exception
│ │ │ └── SwfException.php
│ │ └── SwfClient.php
│ ├── TraceMiddleware.php
│ ├── Waiter.php
│ ├── WorkSpaces
│ │ ├── Exception
│ │ │ └── WorkSpacesException.php
│ │ └── WorkSpacesClient.php
│ ├── WrappedHttpHandler.php
│ ├── data
│ │ ├── autoscaling
│ │ │ └── 2011-01-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── cloudformation
│ │ │ └── 2010-05-15
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ ├── waiters-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── cloudfront
│ │ │ ├── 2014-11-06
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ │ └── 2015-04-17
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── cloudhsm
│ │ │ └── 2014-05-30
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── cloudsearch
│ │ │ └── 2013-01-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── cloudsearchdomain
│ │ │ └── 2013-01-01
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── cloudtrail
│ │ │ └── 2013-11-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── codecommit
│ │ │ └── 2015-04-13
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── codedeploy
│ │ │ └── 2014-10-06
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── codepipeline
│ │ │ └── 2015-07-09
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── cognito-identity
│ │ │ └── 2014-06-30
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── cognito-sync
│ │ │ └── 2014-06-30
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── config
│ │ │ ├── 2014-10-17
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ │ └── 2014-11-12
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── datapipeline
│ │ │ └── 2012-10-29
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── devicefarm
│ │ │ └── 2015-06-23
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── directconnect
│ │ │ └── 2012-10-25
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── ds
│ │ │ └── 2015-04-16
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── dynamodb
│ │ │ └── 2012-08-10
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── ec2
│ │ │ ├── 2015-03-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ │ └── 2015-04-15
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── ecs
│ │ │ └── 2014-11-13
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── elasticache
│ │ │ └── 2015-02-02
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── elasticbeanstalk
│ │ │ └── 2010-12-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── elasticfilesystem
│ │ │ └── 2015-02-01
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── elasticloadbalancing
│ │ │ └── 2012-06-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── elasticmapreduce
│ │ │ └── 2009-03-31
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── elastictranscoder
│ │ │ └── 2012-09-25
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── email
│ │ │ └── 2010-12-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── endpoints.json
│ │ ├── glacier
│ │ │ └── 2012-06-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── iam
│ │ │ └── 2010-05-08
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── kinesis
│ │ │ └── 2013-12-02
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── kms
│ │ │ └── 2014-11-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── lambda
│ │ │ └── 2015-03-31
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── logs
│ │ │ └── 2014-03-28
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── machinelearning
│ │ │ └── 2014-12-12
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── manifest.json
│ │ ├── monitoring
│ │ │ └── 2010-08-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── opsworks
│ │ │ └── 2013-02-18
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── rds
│ │ │ └── 2014-10-31
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── redshift
│ │ │ └── 2012-12-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── route53
│ │ │ └── 2013-04-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── route53domains
│ │ │ └── 2014-05-15
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── s3
│ │ │ └── 2006-03-01
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ ├── paginators-1.json
│ │ │ │ └── waiters-2.json
│ │ ├── sns
│ │ │ └── 2010-03-31
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── sqs
│ │ │ └── 2012-11-05
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── ssm
│ │ │ └── 2014-11-06
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── storagegateway
│ │ │ └── 2013-06-30
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── streams.dynamodb
│ │ │ └── 2012-08-10
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── sts
│ │ │ └── 2011-06-15
│ │ │ │ ├── api-2.json
│ │ │ │ └── docs-2.json
│ │ ├── support
│ │ │ └── 2013-04-15
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ ├── swf
│ │ │ └── 2012-01-25
│ │ │ │ ├── api-2.json
│ │ │ │ ├── docs-2.json
│ │ │ │ └── paginators-1.json
│ │ └── workspaces
│ │ │ └── 2015-04-08
│ │ │ ├── api-2.json
│ │ │ ├── docs-2.json
│ │ │ └── paginators-1.json
│ └── functions.php
├── GuzzleHttp
│ ├── Client.php
│ ├── ClientInterface.php
│ ├── Cookie
│ │ ├── CookieJar.php
│ │ ├── CookieJarInterface.php
│ │ ├── FileCookieJar.php
│ │ ├── SessionCookieJar.php
│ │ └── SetCookie.php
│ ├── Exception
│ │ ├── BadResponseException.php
│ │ ├── ClientException.php
│ │ ├── ConnectException.php
│ │ ├── GuzzleException.php
│ │ ├── RequestException.php
│ │ ├── SeekException.php
│ │ ├── ServerException.php
│ │ ├── TooManyRedirectsException.php
│ │ └── TransferException.php
│ ├── Handler
│ │ ├── CurlFactory.php
│ │ ├── CurlFactoryInterface.php
│ │ ├── CurlHandler.php
│ │ ├── CurlMultiHandler.php
│ │ ├── EasyHandle.php
│ │ ├── MockHandler.php
│ │ ├── Proxy.php
│ │ └── StreamHandler.php
│ ├── HandlerStack.php
│ ├── MessageFormatter.php
│ ├── Middleware.php
│ ├── Pool.php
│ ├── PrepareBodyMiddleware.php
│ ├── Promise
│ │ ├── AggregateException.php
│ │ ├── CancellationException.php
│ │ ├── EachPromise.php
│ │ ├── FulfilledPromise.php
│ │ ├── Promise.php
│ │ ├── PromiseInterface.php
│ │ ├── PromisorInterface.php
│ │ ├── RejectedPromise.php
│ │ ├── RejectionException.php
│ │ ├── TaskQueue.php
│ │ └── functions.php
│ ├── Psr7
│ │ ├── AppendStream.php
│ │ ├── BufferStream.php
│ │ ├── CachingStream.php
│ │ ├── DroppingStream.php
│ │ ├── FnStream.php
│ │ ├── InflateStream.php
│ │ ├── LazyOpenStream.php
│ │ ├── LimitStream.php
│ │ ├── MessageTrait.php
│ │ ├── MultipartStream.php
│ │ ├── NoSeekStream.php
│ │ ├── PumpStream.php
│ │ ├── Request.php
│ │ ├── Response.php
│ │ ├── Stream.php
│ │ ├── StreamDecoratorTrait.php
│ │ ├── StreamWrapper.php
│ │ ├── Uri.php
│ │ └── functions.php
│ ├── RedirectMiddleware.php
│ ├── RequestOptions.php
│ ├── RetryMiddleware.php
│ ├── UriTemplate.php
│ ├── functions.php
│ └── functions_include.php
├── JmesPath
│ ├── AstRuntime.php
│ ├── CompilerRuntime.php
│ ├── DebugRuntime.php
│ ├── Env.php
│ ├── FnDispatcher.php
│ ├── JmesPath.php
│ ├── Lexer.php
│ ├── Parser.php
│ ├── SyntaxErrorException.php
│ ├── TreeCompiler.php
│ ├── TreeInterpreter.php
│ └── Utils.php
├── Psr
│ └── Http
│ │ └── Message
│ │ ├── MessageInterface.php
│ │ ├── RequestInterface.php
│ │ ├── ResponseInterface.php
│ │ ├── ServerRequestInterface.php
│ │ ├── StreamInterface.php
│ │ ├── UploadedFileInterface.php
│ │ └── UriInterface.php
└── TENUP
│ └── ImageGenerator
│ ├── Autoloader.php
│ ├── Client.php
│ ├── Provider.php
│ └── Provider
│ ├── Aws.php
│ ├── S3Uploads.php
│ └── Standard.php
└── tests
├── _bootstrap.php
├── _data
└── image.jpg
├── _support
├── BaseCest.php
├── FunctionalHelper.php
└── UnitHelper.php
├── functional.suite.yml
├── functional
├── DownsizeCest.php
└── GeneratorCest.php
├── unit.suite.yml
└── unit
└── StandardProviderTest.php
/.gitignore:
--------------------------------------------------------------------------------
1 | /tests/_output/
2 | /tests/functional/FunctionalTester.php
3 | /tests/unit/UnitTester.php
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Image Generator
2 |
3 | ## Nginx config
4 |
5 | ```Bash
6 | location ~ \.(gif|jpg|png) {
7 | try_files $uri @img_proxy;
8 | }
9 |
10 | location @img_proxy {
11 | rewrite ^(.*)$ /wp-admin/admin-ajax.php?action=generate_image;
12 | }
13 | ```
14 |
15 | ## Amazon S3 config
16 |
17 | To make it working with Amazon S3 you need to enable website hosting for your bucket in S3 console and update redirection rules by adding following snippet:
18 |
19 | ```Bash
20 |
21 |
22 |
23 | 403
24 |
25 |
26 | yousite.com
27 | wp-admin/admin-ajax.php?action=generate_image&provider=aws&image=
28 | 302
29 |
30 |
31 |
32 | ```
33 |
34 | Please, pay attention to the *HttpErrorCodeReturnedEquals* parameter. It might accept either 403 or 404 code depending on a bucket settings. Also if you use [S3 Uploads](https://github.com/humanmade/S3-Uploads) plugin, then you need to use `S3Uploads` provider name instead of `aws` as shown above. Finally if you stick with `aws` provider, then you need to define ACCESS KEY, SECRET, REGION and BUCKET constants in your wp-config.php file:
35 |
36 | ```PHP
37 | define( 'AWS_ACCESS_KEY_ID', '...' );
38 | define( 'AWS_SECRET_ACCESS_KEY', '...' );
39 | define( 'AWS_S3_REGION', '...' );
40 | define( 'AWS_S3_BUCKET', '...' );
41 | ```
--------------------------------------------------------------------------------
/codeception.yml:
--------------------------------------------------------------------------------
1 | namespace: TENUP\ImageGenerator\Tests
2 | actor: Tester
3 | paths:
4 | tests: tests
5 | log: tests/_output
6 | data: tests/_data
7 | helpers: tests/_support
8 | settings:
9 | bootstrap: _bootstrap.php
10 | colors: true
11 | memory_limit: 256M
12 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "10up/image-generator",
3 | "description": "Image Generator",
4 | "type": "wordpress-plugin",
5 | "keywords": ["wordpress", "plugin", "image"],
6 | "authors": [
7 | {
8 | "name": "10up Inc",
9 | "homepage": "http://10up.com/"
10 | }
11 | ],
12 | "require": {
13 | "php": ">=5.5",
14 | "composer/installers": "~1.0"
15 | }
16 | }
--------------------------------------------------------------------------------
/includes/Aws/Api/AbstractModel.php:
--------------------------------------------------------------------------------
1 | definition = $definition;
22 | $this->shapeMap = $shapeMap;
23 | }
24 |
25 | public function toArray()
26 | {
27 | return $this->definition;
28 | }
29 |
30 | public function offsetGet($offset)
31 | {
32 | return isset($this->definition[$offset])
33 | ? $this->definition[$offset] : null;
34 | }
35 |
36 | public function offsetSet($offset, $value)
37 | {
38 | $this->definition[$offset] = $value;
39 | }
40 |
41 | public function offsetExists($offset)
42 | {
43 | return isset($this->definition[$offset]);
44 | }
45 |
46 | public function offsetUnset($offset)
47 | {
48 | unset($this->definition[$offset]);
49 | }
50 |
51 | protected function shapeAt($key)
52 | {
53 | if (!isset($this->definition[$key])) {
54 | throw new \InvalidArgumentException('Expected shape definition at '
55 | . $key);
56 | }
57 |
58 | return $this->shapeFor($this->definition[$key]);
59 | }
60 |
61 | protected function shapeFor(array $definition)
62 | {
63 | return isset($definition['shape'])
64 | ? $this->shapeMap->resolve($definition)
65 | : Shape::create($definition, $this->shapeMap);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/includes/Aws/Api/DateTimeResult.php:
--------------------------------------------------------------------------------
1 | format('c');
30 | }
31 |
32 | /**
33 | * Serialize the date as an ISO 8601 date when serializing as JSON.
34 | *
35 | * @return mixed|string
36 | */
37 | public function jsonSerialize()
38 | {
39 | return (string) $this;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/includes/Aws/Api/ErrorParser/JsonParserTrait.php:
--------------------------------------------------------------------------------
1 | getStatusCode();
14 |
15 | return [
16 | 'request_id' => (string) $response->getHeaderLine('x-amzn-requestid'),
17 | 'code' => null,
18 | 'message' => null,
19 | 'type' => $code[0] == '4' ? 'client' : 'server',
20 | 'parsed' => json_decode($response->getBody(), true)
21 | ];
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/includes/Aws/Api/ErrorParser/JsonRpcErrorParser.php:
--------------------------------------------------------------------------------
1 | genericHandler($response);
16 | // Make the casing consistent across services.
17 | if ($data['parsed']) {
18 | $data['parsed'] = array_change_key_case($data['parsed']);
19 | }
20 |
21 | if (isset($data['parsed']['__type'])) {
22 | $parts = explode('#', $data['parsed']['__type']);
23 | $data['code'] = isset($parts[1]) ? $parts[1] : $parts[0];
24 | $data['message'] = isset($data['parsed']['message'])
25 | ? $data['parsed']['message']
26 | : null;
27 | }
28 |
29 | return $data;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/includes/Aws/Api/ErrorParser/RestJsonErrorParser.php:
--------------------------------------------------------------------------------
1 | genericHandler($response);
16 |
17 | // Merge in error data from the JSON body
18 | if ($json = $data['parsed']) {
19 | $data = array_replace($data, $json);
20 | }
21 |
22 | // Correct error type from services like Amazon Glacier
23 | if (!empty($data['type'])) {
24 | $data['type'] = strtolower($data['type']);
25 | }
26 |
27 | // Retrieve the error code from services like Amazon Elastic Transcoder
28 | if ($code = $response->getHeaderLine('x-amzn-errortype')) {
29 | $colon = strpos($code, ':');
30 | $data['code'] = $colon ? substr($code, 0, $colon) : $code;
31 | }
32 |
33 | return $data;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/includes/Aws/Api/ListShape.php:
--------------------------------------------------------------------------------
1 | member) {
24 | if (!isset($this->definition['member'])) {
25 | throw new \RuntimeException('No member attribute specified');
26 | }
27 | $this->member = Shape::create(
28 | $this->definition['member'],
29 | $this->shapeMap
30 | );
31 | }
32 |
33 | return $this->member;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/includes/Aws/Api/MapShape.php:
--------------------------------------------------------------------------------
1 | value) {
28 | if (!isset($this->definition['value'])) {
29 | throw new \RuntimeException('No value specified');
30 | }
31 |
32 | $this->value = Shape::create(
33 | $this->definition['value'],
34 | $this->shapeMap
35 | );
36 | }
37 |
38 | return $this->value;
39 | }
40 |
41 | /**
42 | * @return Shape
43 | */
44 | public function getKey()
45 | {
46 | if (!$this->key) {
47 | $this->key = isset($this->definition['key'])
48 | ? Shape::create($this->definition['key'], $this->shapeMap)
49 | : new Shape(['type' => 'string'], $this->shapeMap);
50 | }
51 |
52 | return $this->key;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/AbstractParser.php:
--------------------------------------------------------------------------------
1 | api = $api;
23 | }
24 |
25 | /**
26 | * @param CommandInterface $command Command that was executed.
27 | * @param ResponseInterface $response Response that was received.
28 | *
29 | * @return ResultInterface
30 | */
31 | abstract public function __invoke(
32 | CommandInterface $command,
33 | ResponseInterface $response
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/Crc32ValidatingParser.php:
--------------------------------------------------------------------------------
1 | parser = $parser;
23 | }
24 |
25 | public function __invoke(
26 | CommandInterface $command,
27 | ResponseInterface $response
28 | ) {
29 | if ($expected = $response->getHeaderLine('x-amz-crc32')) {
30 | $hash = hexdec(Psr7\hash($response->getBody(), 'crc32b'));
31 | if ($expected != $hash) {
32 | throw new AwsException(
33 | "crc32 mismatch. Expected {$expected}, found {$hash}.",
34 | $command,
35 | [
36 | 'code' => 'ClientChecksumMismatch',
37 | 'connection_error' => true,
38 | 'response' => $response
39 | ]
40 | );
41 | }
42 | }
43 |
44 | $fn = $this->parser;
45 | return $fn($command, $response);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/JsonParser.php:
--------------------------------------------------------------------------------
1 | getMembers() as $name => $member) {
18 | $name = $member['locationName'] ?: $name;
19 | if (isset($value[$name])) {
20 | $target[$name] = $this->parse($member, $value[$name]);
21 | }
22 | }
23 | return $target;
24 |
25 | case 'list':
26 | $member = $shape->getMember();
27 | $target = [];
28 | foreach ($value as $v) {
29 | $target[] = $this->parse($member, $v);
30 | }
31 | return $target;
32 |
33 | case 'map':
34 | $values = $shape->getValue();
35 | $target = [];
36 | foreach ($value as $k => $v) {
37 | $target[$k] = $this->parse($values, $v);
38 | }
39 | return $target;
40 |
41 | case 'timestamp':
42 | // The Unix epoch (or Unix time or POSIX time or Unix
43 | // timestamp) is the number of seconds that have elapsed since
44 | // January 1, 1970 (midnight UTC/GMT).
45 | return DateTimeResult::fromEpoch($value);
46 |
47 | case 'blob':
48 | return base64_decode($value);
49 |
50 | default:
51 | return $value;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/JsonRpcParser.php:
--------------------------------------------------------------------------------
1 | parser = $parser ?: new JsonParser();
24 | }
25 |
26 | public function __invoke(
27 | CommandInterface $command,
28 | ResponseInterface $response
29 | ) {
30 | $operation = $this->api->getOperation($command->getName());
31 |
32 | return new Result($this->parser->parse(
33 | $operation->getOutput(),
34 | json_decode($response->getBody(), true)
35 | ));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/QueryParser.php:
--------------------------------------------------------------------------------
1 | xmlParser = $xmlParser ?: new XmlParser();
34 | $this->honorResultWrapper = $honorResultWrapper;
35 | }
36 |
37 | public function __invoke(
38 | CommandInterface $command,
39 | ResponseInterface $response
40 | ) {
41 | $output = $this->api->getOperation($command->getName())->getOutput();
42 | $xml = new \SimpleXMLElement($response->getBody());
43 |
44 | if ($this->honorResultWrapper && $output['resultWrapper']) {
45 | $xml = $xml->{$output['resultWrapper']};
46 | }
47 |
48 | return new Result($this->xmlParser->parse($output, $xml));
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/RestJsonParser.php:
--------------------------------------------------------------------------------
1 | parser = $parser ?: new JsonParser();
24 | }
25 |
26 | protected function payload(
27 | ResponseInterface $response,
28 | StructureShape $member,
29 | array &$result
30 | ) {
31 | $jsonBody = json_decode($response->getBody(), true);
32 |
33 | if ($jsonBody) {
34 | $result += $this->parser->parse($member, $jsonBody);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Parser/RestXmlParser.php:
--------------------------------------------------------------------------------
1 | parser = $parser ?: new XmlParser();
24 | }
25 |
26 | protected function payload(
27 | ResponseInterface $response,
28 | StructureShape $member,
29 | array &$result
30 | ) {
31 | $xml = new \SimpleXMLElement($response->getBody());
32 | $result += $this->parser->parse($member, $xml);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Serializer/Ec2ParamBuilder.php:
--------------------------------------------------------------------------------
1 | getMember();
35 | foreach ($value as $k => $v) {
36 | $this->format($items, $v, $prefix . '.' . ($k + 1), $query);
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Serializer/JsonRpcSerializer.php:
--------------------------------------------------------------------------------
1 | endpoint = $endpoint;
38 | $this->api = $api;
39 | $this->jsonFormatter = $jsonFormatter ?: new JsonBody($this->api);
40 | $this->contentType = JsonBody::getContentType($api);
41 | }
42 |
43 | /**
44 | * When invoked with an AWS command, returns a serialization array
45 | * containing "method", "uri", "headers", and "body" key value pairs.
46 | *
47 | * @param CommandInterface $command
48 | *
49 | * @return RequestInterface
50 | */
51 | public function __invoke(CommandInterface $command)
52 | {
53 | $name = $command->getName();
54 | $operation = $this->api->getOperation($name);
55 |
56 | return new Request(
57 | $operation['http']['method'],
58 | $this->endpoint,
59 | [
60 | 'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $name,
61 | 'Content-Type' => $this->contentType
62 | ],
63 | $this->jsonFormatter->build(
64 | $operation->getInput(),
65 | $command->toArray()
66 | )
67 | );
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Serializer/QuerySerializer.php:
--------------------------------------------------------------------------------
1 | api = $api;
25 | $this->endpoint = $endpoint;
26 | $this->paramBuilder = $paramBuilder ?: new QueryParamBuilder();
27 | }
28 |
29 | /**
30 | * When invoked with an AWS command, returns a serialization array
31 | * containing "method", "uri", "headers", and "body" key value pairs.
32 | *
33 | * @param CommandInterface $command
34 | *
35 | * @return RequestInterface
36 | */
37 | public function __invoke(CommandInterface $command)
38 | {
39 | $operation = $this->api->getOperation($command->getName());
40 |
41 | $body = [
42 | 'Action' => $command->getName(),
43 | 'Version' => $this->api->getMetadata('apiVersion')
44 | ];
45 |
46 | $params = $command->toArray();
47 |
48 | // Only build up the parameters when there are parameters to build
49 | if ($params) {
50 | $body += call_user_func(
51 | $this->paramBuilder,
52 | $operation->getInput(),
53 | $params
54 | );
55 | }
56 |
57 | $body = http_build_query($body, null, '&', PHP_QUERY_RFC3986);
58 |
59 | return new Request(
60 | 'POST',
61 | $this->endpoint,
62 | [
63 | 'Content-Length' => strlen($body),
64 | 'Content-Type' => 'application/x-www-form-urlencoded'
65 | ],
66 | $body
67 | );
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Serializer/RestJsonSerializer.php:
--------------------------------------------------------------------------------
1 | contentType = JsonBody::getContentType($api);
31 | $this->jsonFormatter = $jsonFormatter ?: new JsonBody($api);
32 | }
33 |
34 | protected function payload(StructureShape $member, array $value, array &$opts)
35 | {
36 | $opts['headers']['Content-Type'] = $this->contentType;
37 | $opts['body'] = (string) $this->jsonFormatter->build($member, $value);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Serializer/RestXmlSerializer.php:
--------------------------------------------------------------------------------
1 | xmlBody = $xmlBody ?: new XmlBody($api);
27 | }
28 |
29 | protected function payload(StructureShape $member, array $value, array &$opts)
30 | {
31 | $opts['headers']['Content-Type'] = 'application/xml';
32 | $opts['body'] = (string) $this->xmlBody->build($member, $value);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/includes/Aws/Api/Shape.php:
--------------------------------------------------------------------------------
1 | 'Aws\Api\StructureShape',
22 | 'map' => 'Aws\Api\MapShape',
23 | 'list' => 'Aws\Api\ListShape',
24 | 'timestamp' => 'Aws\Api\TimestampShape',
25 | 'integer' => 'Aws\Api\Shape',
26 | 'double' => 'Aws\Api\Shape',
27 | 'float' => 'Aws\Api\Shape',
28 | 'long' => 'Aws\Api\Shape',
29 | 'string' => 'Aws\Api\Shape',
30 | 'byte' => 'Aws\Api\Shape',
31 | 'character' => 'Aws\Api\Shape',
32 | 'blob' => 'Aws\Api\Shape',
33 | 'boolean' => 'Aws\Api\Shape'
34 | ];
35 |
36 | if (isset($definition['shape'])) {
37 | return $shapeMap->resolve($definition);
38 | }
39 |
40 | if (!isset($map[$definition['type']])) {
41 | throw new \RuntimeException('Invalid type: '
42 | . print_r($definition, true));
43 | }
44 |
45 | $type = $map[$definition['type']];
46 |
47 | return new $type($definition, $shapeMap);
48 | }
49 |
50 | /**
51 | * Get the type of the shape
52 | *
53 | * @return string
54 | */
55 | public function getType()
56 | {
57 | return $this->definition['type'];
58 | }
59 |
60 | /**
61 | * Get the name of the shape
62 | *
63 | * @return string
64 | */
65 | public function getName()
66 | {
67 | return $this->definition['name'];
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/includes/Aws/Api/ShapeMap.php:
--------------------------------------------------------------------------------
1 | definitions = $shapeModels;
21 | }
22 |
23 | /**
24 | * Get an array of shape names.
25 | *
26 | * @return array
27 | */
28 | public function getShapeNames()
29 | {
30 | return array_keys($this->definitions);
31 | }
32 |
33 | /**
34 | * Resolve a shape reference
35 | *
36 | * @param array $shapeRef Shape reference shape
37 | *
38 | * @return Shape
39 | * @throws \InvalidArgumentException
40 | */
41 | public function resolve(array $shapeRef)
42 | {
43 | $shape = $shapeRef['shape'];
44 |
45 | if (!isset($this->definitions[$shape])) {
46 | throw new \InvalidArgumentException('Shape not found: ' . $shape);
47 | }
48 |
49 | $isSimple = count($shapeRef) == 1;
50 | if ($isSimple && isset($this->simple[$shape])) {
51 | return $this->simple[$shape];
52 | }
53 |
54 | $definition = $shapeRef + $this->definitions[$shape];
55 | $definition['name'] = $definition['shape'];
56 | unset($definition['shape']);
57 |
58 | $result = Shape::create($definition, $this);
59 |
60 | if ($isSimple) {
61 | $this->simple[$shape] = $result;
62 | }
63 |
64 | return $result;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/includes/Aws/Api/StructureShape.php:
--------------------------------------------------------------------------------
1 | members)) {
33 | $this->generateMembersHash();
34 | }
35 |
36 | return $this->members;
37 | }
38 |
39 | /**
40 | * Check if a specific member exists by name.
41 | *
42 | * @param string $name Name of the member to check
43 | *
44 | * @return bool
45 | */
46 | public function hasMember($name)
47 | {
48 | return isset($this->definition['members'][$name]);
49 | }
50 |
51 | /**
52 | * Retrieve a member by name.
53 | *
54 | * @param string $name Name of the member to retrieve
55 | *
56 | * @return Shape
57 | * @throws \InvalidArgumentException if the member is not found.
58 | */
59 | public function getMember($name)
60 | {
61 | $members = $this->getMembers();
62 |
63 | if (!isset($members[$name])) {
64 | throw new \InvalidArgumentException('Unknown member ' . $name);
65 | }
66 |
67 | return $members[$name];
68 | }
69 |
70 |
71 | private function generateMembersHash()
72 | {
73 | $this->members = [];
74 |
75 | foreach ($this->definition['members'] as $name => $definition) {
76 | $this->members[$name] = $this->shapeFor($definition);
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/includes/Aws/Api/TimestampShape.php:
--------------------------------------------------------------------------------
1 | getTimestamp();
29 | } elseif (is_string($value)) {
30 | $value = strtotime($value);
31 | } elseif (!is_int($value)) {
32 | throw new \InvalidArgumentException('Unable to handle the provided'
33 | . ' timestamp type: ' . gettype($value));
34 | }
35 |
36 | switch ($format) {
37 | case 'iso8601':
38 | return gmdate('Y-m-d\TH:i:s\Z', $value);
39 | case 'rfc822':
40 | return gmdate('D, d M Y H:i:s \G\M\T', $value);
41 | case 'unixTimestamp':
42 | return $value;
43 | default:
44 | throw new \UnexpectedValueException('Unknown timestamp format: '
45 | . $format);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/includes/Aws/AutoScaling/AutoScalingClient.php:
--------------------------------------------------------------------------------
1 | getSignedUrl(
49 | $options['url'],
50 | isset($options['expires']) ? $options['expires'] : null,
51 | isset($options['policy']) ? $options['policy'] : null
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/includes/Aws/CloudFront/Exception/CloudFrontException.php:
--------------------------------------------------------------------------------
1 | s3Client = $s3Client;
26 | }
27 |
28 | /**
29 | * Downloads, unzips, and reads a CloudTrail log file from Amazon S3
30 | *
31 | * @param string $s3BucketName The bucket name of the log file in Amazon S3
32 | * @param string $logFileKey The key of the log file in Amazon S3
33 | *
34 | * @return array
35 | */
36 | public function read($s3BucketName, $logFileKey)
37 | {
38 | // Create a command for getting the log file object
39 | $command = $this->s3Client->getCommand('GetObject', [
40 | 'Bucket' => (string) $s3BucketName,
41 | 'Key' => (string) $logFileKey,
42 | 'ResponseContentEncoding' => 'x-gzip'
43 | ]);
44 |
45 | // Make sure gzip encoding header is sent and accepted in order to
46 | // inflate the response data.
47 | $command['@http']['headers']['Accept-Encoding'] = 'gzip';
48 |
49 | // Get the JSON response data and extract the log records
50 | $result = $this->s3Client->execute($command);
51 | $logData = json_decode($result['Body'], true);
52 |
53 | return isset($logData['Records']) ? $logData['Records'] : [];
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/includes/Aws/CloudWatch/CloudWatchClient.php:
--------------------------------------------------------------------------------
1 | name = $name;
29 | $this->data = $args;
30 | $this->handlerList = $list ?: new HandlerList();
31 |
32 | if (!isset($this->data['@http'])) {
33 | $this->data['@http'] = [];
34 | }
35 | }
36 |
37 | public function getName()
38 | {
39 | return $this->name;
40 | }
41 |
42 | public function hasParam($name)
43 | {
44 | return array_key_exists($name, $this->data);
45 | }
46 |
47 | public function getHandlerList()
48 | {
49 | return $this->handlerList;
50 | }
51 |
52 | /** @deprecated */
53 | public function get($name)
54 | {
55 | return $this[$name];
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/includes/Aws/CommandInterface.php:
--------------------------------------------------------------------------------
1 | key = trim($key);
27 | $this->secret = trim($secret);
28 | $this->token = $token;
29 | $this->expires = $expires;
30 | }
31 |
32 | public function getAccessKeyId()
33 | {
34 | return $this->key;
35 | }
36 |
37 | public function getSecretKey()
38 | {
39 | return $this->secret;
40 | }
41 |
42 | public function getSecurityToken()
43 | {
44 | return $this->token;
45 | }
46 |
47 | public function getExpiration()
48 | {
49 | return $this->expires;
50 | }
51 |
52 | public function isExpired()
53 | {
54 | return $this->expires !== null && time() >= $this->expires;
55 | }
56 |
57 | public function toArray()
58 | {
59 | return [
60 | 'key' => $this->key,
61 | 'secret' => $this->secret,
62 | 'token' => $this->token,
63 | 'expires' => $this->expires
64 | ];
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/includes/Aws/Credentials/CredentialsInterface.php:
--------------------------------------------------------------------------------
1 | value = (string) $value;
25 | }
26 |
27 | public function jsonSerialize()
28 | {
29 | return $this->value;
30 | }
31 |
32 | public function __toString()
33 | {
34 | return $this->value;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/includes/Aws/DynamoDb/DynamoDbClient.php:
--------------------------------------------------------------------------------
1 | register();
38 |
39 | return $handler;
40 | }
41 |
42 | /** @internal */
43 | public static function _applyRetryConfig($value, array &$args, HandlerList $list)
44 | {
45 | if (!$value) {
46 | return;
47 | }
48 |
49 | $list->appendSign(
50 | Middleware::retry(
51 | RetryMiddleware::createDefaultDecider($value),
52 | function ($retries) {
53 | return $retries
54 | ? (50 * (int) pow(2, $retries - 1)) / 1000
55 | : 0;
56 | }
57 | ),
58 | 'retry'
59 | );
60 | }
61 |
62 | /** @internal */
63 | public static function _applyApiProvider($value, array &$args, HandlerList $list)
64 | {
65 | ClientResolver::_apply_api_provider($value, $args, $list);
66 | $args['parser'] = new Crc32ValidatingParser($args['parser']);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/includes/Aws/DynamoDb/Exception/DynamoDbException.php:
--------------------------------------------------------------------------------
1 | 10,
15 | 'min_lock_retry_microtime' => 10000,
16 | 'max_lock_retry_microtime' => 50000,
17 | ]);
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | * Retries the request until the lock can be acquired
23 | */
24 | public function read($id)
25 | {
26 | // Create the params for the UpdateItem operation so that a lock can be
27 | // set and item returned (via ReturnValues) in a one, atomic operation.
28 | $params = [
29 | 'TableName' => $this->config['table_name'],
30 | 'Key' => $this->formatKey($id),
31 | 'Expected' => ['lock' => ['Exists' => false]],
32 | 'AttributeUpdates' => ['lock' => ['Value' => ['N' => '1']]],
33 | 'ReturnValues' => 'ALL_NEW',
34 | ];
35 |
36 | // Acquire the lock and fetch the item data.
37 | $timeout = time() + $this->config['max_lock_wait_time'];
38 | while (true) {
39 | try {
40 | $item = [];
41 | $result = $this->client->updateItem($params);
42 | if (isset($result['Attributes'])) {
43 | foreach ($result['Attributes'] as $key => $value) {
44 | $item[$key] = current($value);
45 | }
46 | }
47 | return $item;
48 | } catch (DynamoDbException $e) {
49 | if ($e->getAwsErrorCode() === 'ConditionalCheckFailedException'
50 | && time() < $timeout
51 | ) {
52 | usleep(pow(10, -6) * rand(
53 | $this->config['min_lock_retry_microtime'],
54 | $this->config['max_lock_retry_microtime']
55 | ));
56 | } else {
57 | break;
58 | }
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/includes/Aws/DynamoDb/NumberValue.php:
--------------------------------------------------------------------------------
1 | value = (string) $value;
18 | }
19 |
20 | public function jsonSerialize()
21 | {
22 | return $this->value;
23 | }
24 |
25 | public function __toString()
26 | {
27 | return $this->value;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/includes/Aws/DynamoDb/SessionConnectionInterface.php:
--------------------------------------------------------------------------------
1 | values = $values;
18 | }
19 |
20 | /**
21 | * Get the values formatted for PHP and JSON.
22 | *
23 | * @return array
24 | */
25 | public function toArray()
26 | {
27 | return $this->values;
28 | }
29 |
30 | public function count()
31 | {
32 | return count($this->values);
33 | }
34 |
35 | public function getIterator()
36 | {
37 | return new \ArrayIterator($this->values);
38 | }
39 |
40 | public function jsonSerialize()
41 | {
42 | return $this->toArray();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/includes/Aws/DynamoDbStreams/DynamoDbStreamsClient.php:
--------------------------------------------------------------------------------
1 | getHandlerList()->appendInit(
18 | CopySnapshotMiddleware::wrap(
19 | $this,
20 | $args['endpoint_provider']
21 | ),
22 | 'ec2.copy_snapshot'
23 | );
24 | };
25 |
26 | parent::__construct($args);
27 | }
28 |
29 | /**
30 | * @internal
31 | * @codeCoverageIgnore
32 | */
33 | public static function applyDocFilters(array $api, array $docs)
34 | {
35 | // Several copy snapshot parameters are optional.
36 | $docs['shapes']['String']['refs']['CopySnapshotRequest$PresignedUrl']
37 | = '
The SDK will compute this value '
38 | . 'for you on your behalf.
';
39 | $docs['shapes']['String']['refs']['CopySnapshotRequest$DestinationRegion']
40 | = 'The SDK will populate this '
41 | . 'parameter on your behalf using the configured region value of '
42 | . 'the client.
';
43 |
44 | return [
45 | new Service($api, ApiProvider::defaultProvider()),
46 | new DocModel($docs)
47 | ];
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/includes/Aws/Ec2/Exception/Ec2Exception.php:
--------------------------------------------------------------------------------
1 | patterns = $patterns;
19 | }
20 |
21 | public function __invoke(array $args = [])
22 | {
23 | $service = isset($args['service']) ? $args['service'] : '';
24 | $region = isset($args['region']) ? $args['region'] : '';
25 | $keys = ["{$region}/{$service}", "{$region}/*", "*/{$service}", "*/*"];
26 |
27 | foreach ($keys as $key) {
28 | if (isset($this->patterns[$key])) {
29 | return $this->expand(
30 | $this->patterns[$key],
31 | isset($args['scheme']) ? $args['scheme'] : 'https',
32 | $service,
33 | $region
34 | );
35 | }
36 | }
37 |
38 | return null;
39 | }
40 |
41 | private function expand(array $config, $scheme, $service, $region)
42 | {
43 | $config['endpoint'] = $scheme . '://'
44 | . strtr($config['endpoint'], [
45 | '{service}' => $service,
46 | '{region}' => $region
47 | ]);
48 |
49 | return $config;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/includes/Aws/Exception/CouldNotCreateChecksumException.php:
--------------------------------------------------------------------------------
1 | 'uploading parts to']);
20 | $msg .= " The following parts had errors:\n";
21 | /** @var $error AwsException */
22 | foreach ($prev as $part => $error) {
23 | $msg .= "- Part {$part}: " . $error->getMessage(). "\n";
24 | }
25 | } elseif ($prev instanceof AwsException) {
26 | switch ($prev->getCommand()->getName()) {
27 | case 'CreateMultipartUpload':
28 | case 'InitiateMultipartUpload':
29 | $action = 'initiating';
30 | break;
31 | case 'CompleteMultipartUpload':
32 | $action = 'completing';
33 | break;
34 | }
35 | if (isset($action)) {
36 | $msg = strtr($msg, ['performing' => $action]);
37 | }
38 | }
39 |
40 | if (!$prev instanceof \Exception) {
41 | $prev = null;
42 | }
43 |
44 | parent::__construct($msg, 0, $prev);
45 | $this->state = $state;
46 | }
47 |
48 | /**
49 | * Get the state of the transfer
50 | *
51 | * @return UploadState
52 | */
53 | public function getState()
54 | {
55 | return $this->state;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/includes/Aws/Exception/UnresolvedApiException.php:
--------------------------------------------------------------------------------
1 | stream = $stream;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/includes/Aws/Handler/GuzzleV5/PsrStream.php:
--------------------------------------------------------------------------------
1 | stream = $stream;
23 | }
24 |
25 | public function rewind()
26 | {
27 | $this->stream->seek(0);
28 | }
29 |
30 | public function getContents()
31 | {
32 | return $this->stream->getContents();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/includes/Aws/Handler/GuzzleV6/GuzzleHandler.php:
--------------------------------------------------------------------------------
1 | client = $client ?: new Client();
27 | }
28 |
29 | /**
30 | * @param Psr7Request $request
31 | * @param array $options
32 | *
33 | * @return Promise\Promise
34 | */
35 | public function __invoke(Psr7Request $request, array $options = [])
36 | {
37 | $request = $request->withHeader(
38 | 'User-Agent',
39 | 'aws-sdk-php/' . Sdk::VERSION . ' ' . \GuzzleHttp\default_user_agent()
40 | );
41 |
42 | return $this->client->sendAsync($request, $options)->otherwise(
43 | static function (\Exception $e) {
44 | $error = [
45 | 'exception' => $e,
46 | 'connection_error' => $e instanceof ConnectException,
47 | 'response' => null,
48 | ];
49 |
50 | if ($e instanceof RequestException && $e->getResponse()) {
51 | $error['response'] = $e->getResponse();
52 | }
53 |
54 | return new Promise\RejectedPromise($error);
55 | }
56 | );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/includes/Aws/HasDataTrait.php:
--------------------------------------------------------------------------------
1 | data);
16 | }
17 |
18 | /**
19 | * This method returns a reference to the variable to allow for indirect
20 | * array modification (e.g., $foo['bar']['baz'] = 'qux').
21 | *
22 | * @param $offset
23 | *
24 | * @return mixed|null
25 | */
26 | public function & offsetGet($offset)
27 | {
28 | if (isset($this->data[$offset])) {
29 | return $this->data[$offset];
30 | }
31 |
32 | $value = null;
33 | return $value;
34 | }
35 |
36 | public function offsetSet($offset, $value)
37 | {
38 | $this->data[$offset] = $value;
39 | }
40 |
41 | public function offsetExists($offset)
42 | {
43 | return isset($this->data[$offset]);
44 | }
45 |
46 | public function offsetUnset($offset)
47 | {
48 | unset($this->data[$offset]);
49 | }
50 |
51 | public function toArray()
52 | {
53 | return $this->data;
54 | }
55 |
56 | public function count()
57 | {
58 | return count($this->data);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/includes/Aws/HashInterface.php:
--------------------------------------------------------------------------------
1 | stream = $stream;
32 | $this->hash = $hash;
33 | $this->callback = $onComplete;
34 | }
35 |
36 | public function read($length)
37 | {
38 | $data = $this->stream->read($length);
39 | $this->hash->update($data);
40 | if ($this->eof()) {
41 | $result = $this->hash->complete();
42 | if ($this->callback) {
43 | call_user_func($this->callback, $result);
44 | }
45 | }
46 |
47 | return $data;
48 | }
49 |
50 | public function seek($offset, $whence = SEEK_SET)
51 | {
52 | if ($offset === 0) {
53 | $this->hash->reset();
54 | return $this->stream->seek($offset);
55 | } else {
56 | // Seeking arbitrarily is not supported.
57 | return false;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/includes/Aws/Iam/Exception/IamException.php:
--------------------------------------------------------------------------------
1 | maxItems = $maxItems;
28 | }
29 |
30 | public function get($key)
31 | {
32 | if (!isset($this->items[$key])) {
33 | return null;
34 | }
35 |
36 | $entry = $this->items[$key];
37 |
38 | // Ensure the item is not expired.
39 | if (!$entry[1] || time() < $entry[1]) {
40 | // LRU: remove the item and push it to the end of the array.
41 | unset($this->items[$key]);
42 | $this->items[$key] = $entry;
43 | return $entry[0];
44 | }
45 |
46 | unset($this->items[$key]);
47 | return null;
48 | }
49 |
50 | public function set($key, $value, $ttl = 0)
51 | {
52 | // Only call time() if the TTL is not 0/false/null
53 | $ttl = $ttl ? time() + $ttl : 0;
54 | $this->items[$key] = [$value, $ttl];
55 |
56 | // Determine if there are more items in the cache than allowed.
57 | $diff = count($this->items) - $this->maxItems;
58 |
59 | // Clear out least recently used items.
60 | if ($diff > 0) {
61 | // Reset to the beginning of the array and begin unsetting.
62 | reset($this->items);
63 | for ($i = 0; $i < $diff; $i++) {
64 | unset($this->items[key($this->items)]);
65 | next($this->items);
66 | }
67 | }
68 | }
69 |
70 | public function remove($key)
71 | {
72 | unset($this->items[$key]);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/includes/Aws/MachineLearning/Exception/MachineLearningException.php:
--------------------------------------------------------------------------------
1 | getHandlerList();
18 | $list->appendBuild($this->predictEndpoint(), 'ml.predict_endpoint');
19 | }
20 |
21 | /**
22 | * Changes the endpoint of the Predict operation to the provided endpoint.
23 | *
24 | * @return callable
25 | */
26 | private function predictEndpoint()
27 | {
28 | return static function (callable $handler) {
29 | return function (
30 | CommandInterface $command,
31 | RequestInterface $request = null
32 | ) use ($handler) {
33 | if ($command->getName() === 'Predict') {
34 | $request = $request->withUri(new Uri($command['PredictEndpoint']));
35 | }
36 | return $handler($command, $request);
37 | };
38 | };
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/includes/Aws/OpsWorks/Exception/OpsWorksException.php:
--------------------------------------------------------------------------------
1 | algo = $algo;
31 | $this->options = $options;
32 | }
33 |
34 | public function update($data)
35 | {
36 | if ($this->hash !== null) {
37 | $this->reset();
38 | }
39 |
40 | hash_update($this->getContext(), $data);
41 | }
42 |
43 | public function complete()
44 | {
45 | if ($this->hash) {
46 | return $this->hash;
47 | }
48 |
49 | $this->hash = hash_final($this->getContext(), true);
50 |
51 | if (isset($this->options['base64']) && $this->options['base64']) {
52 | $this->hash = base64_encode($this->hash);
53 | }
54 |
55 | return $this->hash;
56 | }
57 |
58 | public function reset()
59 | {
60 | $this->context = $this->hash = null;
61 | }
62 |
63 | /**
64 | * Get a hash context or create one if needed
65 | *
66 | * @return resource
67 | */
68 | private function getContext()
69 | {
70 | if (!$this->context) {
71 | $key = isset($this->options['key']) ? $this->options['key'] : null;
72 | $this->context = hash_init(
73 | $this->algo,
74 | $key ? HASH_HMAC : 0,
75 | $key
76 | );
77 | }
78 |
79 | return $this->context;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/includes/Aws/Rds/Exception/RdsException.php:
--------------------------------------------------------------------------------
1 | data = $data;
16 | }
17 |
18 | public function hasKey($name)
19 | {
20 | return isset($this->data[$name]);
21 | }
22 |
23 | public function get($key)
24 | {
25 | return $this[$key];
26 | }
27 |
28 | public function search($expression)
29 | {
30 | return JmesPath::search($expression, $this->toArray());
31 | }
32 |
33 | public function __toString()
34 | {
35 | $jsonData = json_encode($this->toArray(), JSON_PRETTY_PRINT);
36 | return <<get(\$key)`) or "accessing the result like an
41 | associative array (e.g. `\$result['key']`). You can also execute JMESPath
42 | expressions on the result data using the search() method.
43 |
44 | {$jsonData}
45 |
46 | EOT;
47 | }
48 |
49 | /**
50 | * @deprecated
51 | */
52 | public function getPath($path)
53 | {
54 | return $this->search(str_replace('/', '.', $path));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/includes/Aws/ResultInterface.php:
--------------------------------------------------------------------------------
1 | execute($command);
46 | * $jpResult = $result->search('foo.*.bar[?baz > `10`]');
47 | *
48 | * @param string $expression JMESPath expression to execute
49 | *
50 | * @return mixed Returns the result of the JMESPath expression.
51 | * @link http://jmespath.readthedocs.org/en/latest/ JMESPath documentation
52 | */
53 | public function search($expression);
54 | };
55 |
--------------------------------------------------------------------------------
/includes/Aws/Route53/Exception/Route53Exception.php:
--------------------------------------------------------------------------------
1 | getHandlerList()->appendInit($this->cleanIdFn(), 'route53.clean_id');
17 | }
18 |
19 | private function cleanIdFn()
20 | {
21 | return function (callable $handler) {
22 | return function (CommandInterface $c, RequestInterface $r = null) use ($handler) {
23 | foreach (['Id', 'HostedZoneId'] as $clean) {
24 | if ($c->hasParam($clean)) {
25 | $c[$clean] = $this->cleanId($c[$clean]);
26 | }
27 | }
28 | return $handler($c, $r);
29 | };
30 | };
31 | }
32 |
33 | private function cleanId($id)
34 | {
35 | static $toClean = ['/hostedzone/', '/change/', '/delegationset/'];
36 |
37 | return str_replace($toClean, '', $id);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/includes/Aws/Route53Domains/Exception/Route53DomainsException.php:
--------------------------------------------------------------------------------
1 | nextHandler = $nextHandler;
47 | }
48 |
49 | public function __invoke(
50 | CommandInterface $command,
51 | RequestInterface $request
52 | ) {
53 | $next = $this->nextHandler;
54 | $name = $command->getName();
55 | $body = $request->getBody();
56 |
57 | if (in_array($name, self::$md5) && !$request->hasHeader('Content-MD5')) {
58 | // Set the content MD5 header for operations that require it.
59 | $request = $request->withHeader(
60 | 'Content-MD5',
61 | base64_encode(Psr7\hash($body, 'md5', true))
62 | );
63 | } elseif (in_array($name, self::$sha256) && $command['ContentSHA256']) {
64 | // Set the content hash header if provided in the parameters.
65 | $request = $request->withHeader(
66 | 'X-Amz-Content-Sha256',
67 | $command['ContentSHA256']
68 | );
69 | }
70 |
71 | return $next($command, $request);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/includes/Aws/S3/ApplyMd5Middleware.php:
--------------------------------------------------------------------------------
1 | nextHandler = $nextHandler;
43 | }
44 |
45 | public function __invoke(
46 | CommandInterface $command,
47 | RequestInterface $request
48 | ) {
49 | $name = $command->getName();
50 | $body = $request->getBody();
51 | if (!$request->hasHeader('Content-MD5')
52 | && $body->getSize()
53 | && in_array($name, self::$requireMd5)
54 | ) {
55 | $request = $request->withHeader(
56 | 'Content-MD5',
57 | base64_encode(Psr7\hash($body, 'md5', true))
58 | );
59 | }
60 |
61 | $next = $this->nextHandler;
62 | return $next($command, $request);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/includes/Aws/S3/BucketEndpointMiddleware.php:
--------------------------------------------------------------------------------
1 | true];
18 | private $nextHandler;
19 |
20 | /**
21 | * Create a middleware wrapper function.
22 | *
23 | * @return callable
24 | */
25 | public static function wrap()
26 | {
27 | return function (callable $handler) {
28 | return new self($handler);
29 | };
30 | }
31 |
32 | public function __construct(callable $nextHandler)
33 | {
34 | $this->nextHandler = $nextHandler;
35 | }
36 |
37 | public function __invoke(CommandInterface $command, RequestInterface $request)
38 | {
39 | $nextHandler = $this->nextHandler;
40 | $bucket = $command['Bucket'];
41 |
42 | if ($bucket && !isset(self::$exclusions[$command->getName()])) {
43 | $request = $this->modifyRequest($request, $command);
44 | }
45 |
46 | return $nextHandler($command, $request);
47 | }
48 |
49 | private function removeBucketFromPath($path, $bucket)
50 | {
51 | $len = strlen($bucket) + 1;
52 | if (substr($path, 0, $len) === "/{$bucket}") {
53 | $path = substr($path, $len);
54 | }
55 |
56 | return $path ?: '/';
57 | }
58 |
59 | private function modifyRequest(
60 | RequestInterface $request,
61 | CommandInterface $command
62 | ) {
63 | $uri = $request->getUri();
64 | $path = $uri->getPath();
65 | $bucket = $command['Bucket'];
66 | $path = $this->removeBucketFromPath($path, $bucket);
67 |
68 | // Modify the Key to make sure the key is encoded, but slashes are not.
69 | if ($command['Key']) {
70 | $path = S3Client::encodeKey(rawurldecode($path));
71 | }
72 |
73 | return $request->withUri($uri->withPath($path));
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/includes/Aws/S3/Exception/DeleteMultipleObjectsException.php:
--------------------------------------------------------------------------------
1 | deleted = array_values($deleted);
20 | $this->errors = array_values($errors);
21 | parent::__construct('Unable to delete certain keys when executing a'
22 | . ' DeleteMultipleObjects request: '
23 | . self::createMessageFromErrors($errors));
24 | }
25 |
26 | /**
27 | * Create a single error message from multiple errors.
28 | *
29 | * @param array $errors Errors encountered
30 | *
31 | * @return string
32 | */
33 | public static function createMessageFromErrors(array $errors)
34 | {
35 | return "\n- " . implode("\n- ", array_map(function ($key) {
36 | return json_encode($key);
37 | }, $errors));
38 | }
39 |
40 | /**
41 | * Get the errored objects
42 | *
43 | * @return array Returns an array of associative arrays, each containing
44 | * a 'Code', 'Message', and 'Key' key.
45 | */
46 | public function getErrors()
47 | {
48 | return $this->errors;
49 | }
50 |
51 | /**
52 | * Get the successfully deleted objects
53 | *
54 | * @return array Returns an array of associative arrays, each containing
55 | * a 'Key' and optionally 'DeleteMarker' and
56 | * 'DeleterMarkerVersionId'
57 | */
58 | public function getDeleted()
59 | {
60 | return $this->deleted;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/includes/Aws/S3/Exception/PermanentRedirectException.php:
--------------------------------------------------------------------------------
1 | parser = $parser;
23 | }
24 |
25 | public function __invoke(
26 | CommandInterface $command,
27 | ResponseInterface $response
28 | ) {
29 | $fn = $this->parser;
30 | $result = $fn($command, $response);
31 |
32 | if ($command->getName() === 'GetBucketLocation') {
33 | $location = 'us-east-1';
34 | if (preg_match('/>(.+?)<\/LocationConstraint>/', $response->getBody(), $matches)) {
35 | $location = $matches[1] === 'EU' ? 'eu-west-1' : $matches[1];
36 | }
37 | $result['LocationConstraint'] = $location;
38 | }
39 |
40 | return $result;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/includes/Aws/S3/PermanentRedirectMiddleware.php:
--------------------------------------------------------------------------------
1 | nextHandler = $nextHandler;
38 | }
39 |
40 | public function __invoke(CommandInterface $command, RequestInterface $request = null)
41 | {
42 | $next = $this->nextHandler;
43 | return $next($command, $request)->then(
44 | function (ResultInterface $result) use ($command) {
45 | $status = isset($result['@metadata']['statusCode'])
46 | ? $result['@metadata']['statusCode']
47 | : null;
48 | if ($status == 301) {
49 | throw new PermanentRedirectException(
50 | 'Encountered a permanent redirect while requesting '
51 | . $result->search('"@metadata".effectiveUri') . '. '
52 | . 'Are you sure you are using the correct region for '
53 | . 'this bucket?',
54 | $command,
55 | ['result' => $result]
56 | );
57 | }
58 | return $result;
59 | }
60 | );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/includes/Aws/S3/PutObjectUrlMiddleware.php:
--------------------------------------------------------------------------------
1 | nextHandler = $nextHandler;
36 | }
37 |
38 | public function __invoke(CommandInterface $command, RequestInterface $request = null)
39 | {
40 | $next = $this->nextHandler;
41 | return $next($command, $request)->then(
42 | function (ResultInterface $result) use ($command) {
43 | $name = $command->getName();
44 | switch ($name) {
45 | case 'PutObject':
46 | case 'CopyObject':
47 | $result['ObjectURL'] = $result['@metadata']['effectiveUri'];
48 | break;
49 | case 'CompleteMultipartUpload':
50 | $result['ObjectURL'] = $result['Location'];
51 | break;
52 | }
53 | return $result;
54 | }
55 | );
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/includes/Aws/Ses/Exception/SesException.php:
--------------------------------------------------------------------------------
1 | hasHeader('x-amz-content-sha256')) {
20 | $request = $request->withHeader(
21 | 'X-Amz-Content-Sha256',
22 | $this->getPayload($request)
23 | );
24 | }
25 |
26 | return parent::signRequest($request, $credentials);
27 | }
28 |
29 | /**
30 | * Override used to allow pre-signed URLs to be created for an
31 | * in-determinate request payload.
32 | */
33 | protected function getPresignedPayload(RequestInterface $request)
34 | {
35 | return 'UNSIGNED-PAYLOAD';
36 | }
37 |
38 | /**
39 | * Amazon S3 does not double-encode the path component in the canonical request
40 | */
41 | protected function createCanonicalizedPath($path)
42 | {
43 | return '/' . ltrim($path, '/');
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/includes/Aws/Signature/SignatureInterface.php:
--------------------------------------------------------------------------------
1 | hasKey('Credentials')) {
24 | throw new \InvalidArgumentException('Result contains no credentials');
25 | }
26 |
27 | $c = $result['Credentials'];
28 |
29 | return new Credentials(
30 | $c['AccessKeyId'],
31 | $c['SecretAccessKey'],
32 | isset($c['SessionToken']) ? $c['SessionToken'] : null,
33 | isset($c['Expiration']) ? $c['Expiration'] : null
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/includes/Aws/Support/Exception/SupportException.php:
--------------------------------------------------------------------------------
1 | sessionKey = $sessionKey;
20 | $this->load();
21 | }
22 |
23 | /**
24 | * Saves cookies to session when shutting down
25 | */
26 | public function __destruct()
27 | {
28 | $this->save();
29 | }
30 |
31 | /**
32 | * Save cookies to the client session
33 | */
34 | public function save()
35 | {
36 | $json = [];
37 | foreach ($this as $cookie) {
38 | /** @var SetCookie $cookie */
39 | if ($cookie->getExpires() && !$cookie->getDiscard()) {
40 | $json[] = $cookie->toArray();
41 | }
42 | }
43 |
44 | $_SESSION[$this->sessionKey] = json_encode($json);
45 | }
46 |
47 | /**
48 | * Load the contents of the client session into the data array
49 | */
50 | protected function load()
51 | {
52 | $cookieJar = isset($_SESSION[$this->sessionKey])
53 | ? $_SESSION[$this->sessionKey]
54 | : null;
55 |
56 | $data = json_decode($cookieJar, true);
57 | if (is_array($data)) {
58 | foreach ($data as $cookie) {
59 | $this->setCookie(new SetCookie($cookie));
60 | }
61 | } elseif (strlen($data)) {
62 | throw new \RuntimeException("Invalid cookie data");
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Exception/BadResponseException.php:
--------------------------------------------------------------------------------
1 | stream = $stream;
16 | $msg = $msg ?: 'Could not seek the stream to position ' . $pos;
17 | parent::__construct($msg);
18 | }
19 |
20 | /**
21 | * @return StreamInterface
22 | */
23 | public function getStream()
24 | {
25 | return $this->stream;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Exception/ServerException.php:
--------------------------------------------------------------------------------
1 | factory = isset($options['handle_factory'])
29 | ? $options['handle_factory']
30 | : new CurlFactory(3);
31 | }
32 |
33 | public function __invoke(RequestInterface $request, array $options)
34 | {
35 | if (isset($options['delay'])) {
36 | usleep($options['delay'] * 1000);
37 | }
38 |
39 | $easy = $this->factory->create($request, $options);
40 | curl_exec($easy->handle);
41 | $easy->errno = curl_errno($easy->handle);
42 |
43 | return CurlFactory::finish($this, $easy, $this->factory);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Handler/Proxy.php:
--------------------------------------------------------------------------------
1 | value = $value;
22 | }
23 |
24 | public function then(
25 | callable $onFulfilled = null,
26 | callable $onRejected = null
27 | ) {
28 | // Return itself if there is no onFulfilled function.
29 | if (!$onFulfilled) {
30 | return $this;
31 | }
32 |
33 | $queue = queue();
34 | $p = new Promise([$queue, 'run']);
35 | $value = $this->value;
36 | $queue->add(static function () use ($p, $value, $onFulfilled) {
37 | if ($p->getState() === self::PENDING) {
38 | try {
39 | $p->resolve($onFulfilled($value));
40 | } catch (\Exception $e) {
41 | $p->reject($e);
42 | }
43 | }
44 | });
45 |
46 | return $p;
47 | }
48 |
49 | public function otherwise(callable $onRejected)
50 | {
51 | return $this->then(null, $onRejected);
52 | }
53 |
54 | public function wait($unwrap = true, $defaultDelivery = null)
55 | {
56 | return $unwrap ? $this->value : null;
57 | }
58 |
59 | public function getState()
60 | {
61 | return self::FULFILLED;
62 | }
63 |
64 | public function resolve($value)
65 | {
66 | if ($value !== $this->value) {
67 | throw new \LogicException("Cannot resolve a fulfilled promise");
68 | }
69 | }
70 |
71 | public function reject($reason)
72 | {
73 | throw new \LogicException("Cannot reject a fulfilled promise");
74 | }
75 |
76 | public function cancel()
77 | {
78 | // pass
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Promise/PromisorInterface.php:
--------------------------------------------------------------------------------
1 | reason = $reason;
21 |
22 | $message = 'The promise was rejected';
23 |
24 | if ($description) {
25 | $message .= ' with reason: ' . $description;
26 | } elseif (is_string($reason)
27 | || (is_object($reason) && method_exists($reason, '__toString'))
28 | ) {
29 | $message .= ' with reason: ' . $this->reason;
30 | } elseif ($reason instanceof \JsonSerializable) {
31 | $message .= ' with reason: '
32 | . json_encode($this->reason, JSON_PRETTY_PRINT);
33 | }
34 |
35 | parent::__construct($message);
36 | }
37 |
38 | /**
39 | * Returns the rejection reason.
40 | *
41 | * @return mixed
42 | */
43 | public function getReason()
44 | {
45 | return $this->reason;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Psr7/DroppingStream.php:
--------------------------------------------------------------------------------
1 | stream = $stream;
23 | $this->maxLength = $maxLength;
24 | }
25 |
26 | public function write($string)
27 | {
28 | $diff = $this->maxLength - $this->stream->getSize();
29 |
30 | // Begin returning 0 when the underlying stream is too large.
31 | if ($diff <= 0) {
32 | return 0;
33 | }
34 |
35 | // Write the stream or a subset of the stream if needed.
36 | if (strlen($string) < $diff) {
37 | return $this->stream->write($string);
38 | }
39 |
40 | return $this->stream->write(substr($string, 0, $diff));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Psr7/InflateStream.php:
--------------------------------------------------------------------------------
1 | stream = new Stream($resource);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Psr7/LazyOpenStream.php:
--------------------------------------------------------------------------------
1 | filename = $filename;
27 | $this->mode = $mode;
28 | }
29 |
30 | /**
31 | * Creates the underlying stream lazily when required.
32 | *
33 | * @return StreamInterface
34 | */
35 | protected function createStream()
36 | {
37 | return stream_for(try_fopen($this->filename, $this->mode));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/includes/GuzzleHttp/Psr7/NoSeekStream.php:
--------------------------------------------------------------------------------
1 | interpreter = new TreeInterpreter($fnDispatcher);
20 | $this->parser = $parser ?: new Parser();
21 | }
22 |
23 | /**
24 | * Returns data from the provided input that matches a given JMESPath
25 | * expression.
26 | *
27 | * @param string $expression JMESPath expression to evaluate
28 | * @param mixed $data Data to search. This data should be data that
29 | * is similar to data returned from json_decode
30 | * using associative arrays rather than objects.
31 | *
32 | * @return mixed|null Returns the matching data or null
33 | */
34 | public function __invoke($expression, $data)
35 | {
36 | if (!isset($this->cache[$expression])) {
37 | // Clear the AST cache when it hits 1024 entries
38 | if (++$this->cachedCount > 1024) {
39 | $this->cache = [];
40 | $this->cachedCount = 0;
41 | }
42 | $this->cache[$expression] = $this->parser->parse($expression);
43 | }
44 |
45 | return $this->interpreter->visit($this->cache[$expression], $data);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/includes/JmesPath/Env.php:
--------------------------------------------------------------------------------
1 | createTokenMessage($token, $expectedTypesOrMessage);
24 | parent::__construct($message);
25 | }
26 |
27 | private function createTokenMessage(array $token, array $valid)
28 | {
29 | return sprintf(
30 | 'Expected one of the following: %s; found %s "%s"',
31 | implode(', ', array_keys($valid)),
32 | $token['type'],
33 | $token['value']
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/tests/_bootstrap.php:
--------------------------------------------------------------------------------
1 |