Ejemplo n.º 1
0
 /**
  * @internal
  * @codeCoverageIgnore
  */
 public static function applyDocFilters(array $api, array $docs)
 {
     // Several copy snapshot parameters are optional.
     $docs['shapes']['String']['refs']['CopySnapshotRequest$PresignedUrl'] = '<div class="alert alert-info">The SDK will compute this value ' . 'for you on your behalf.</div>';
     $docs['shapes']['String']['refs']['CopySnapshotRequest$DestinationRegion'] = '<div class="alert alert-info">The SDK will populate this ' . 'parameter on your behalf using the configured region value of ' . 'the client.</div>';
     return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)];
 }
Ejemplo n.º 2
0
 /**
  * @internal
  * @codeCoverageIgnore
  */
 public static function applyDocFilters(array $api, array $docs)
 {
     // Overcomes a naming collision with `AwsClient::getConfig`.
     $api['operations']['GetConfigFiles'] = $api['operations']['GetConfig'];
     $docs['operations']['GetConfigFiles'] = $docs['operations']['GetConfig'];
     unset($api['operations']['GetConfig'], $docs['operations']['GetConfig']);
     ksort($api['operations']);
     return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)];
 }
Ejemplo n.º 3
0
 /**
  * @param callable $provider
  * @param string   $serviceName
  * @param string   $apiVersion
  *
  * @internal param array $definition Service description
  */
 public function __construct(callable $provider, $serviceName, $apiVersion)
 {
     static $defaults = ['operations' => [], 'shapes' => [], 'metadata' => []], $defaultMeta = ['serviceFullName' => null, 'apiVersion' => null, 'endpointPrefix' => null, 'signingName' => null, 'signatureVersion' => null, 'protocol' => null];
     $this->apiProvider = $provider;
     $this->serviceName = $serviceName;
     $this->apiVersion = $apiVersion;
     $definition = ApiProvider::resolve($provider, 'api', $serviceName, $apiVersion) + $defaults;
     $definition['metadata'] += $defaultMeta;
     parent::__construct($definition, new ShapeMap($definition['shapes']));
 }
Ejemplo n.º 4
0
 /**
  * @internal
  * @codeCoverageIgnore
  */
 public static function applyDocFilters(array $api, array $docs)
 {
     $b64 = '<div class="alert alert-info">This value will be base64 encoded on your behalf.</div>';
     $opt = '<div class="alert alert-info">This value will be computed for you it is not supplied.</div>';
     // Add the SourceFile parameter.
     $docs['shapes']['SourceFile']['base'] = 'The path to a file on disk to use instead of the Body parameter.';
     $api['shapes']['SourceFile'] = ['type' => 'string'];
     $api['shapes']['PutObjectRequest']['members']['SourceFile'] = ['shape' => 'SourceFile'];
     $api['shapes']['UploadPartRequest']['members']['SourceFile'] = ['shape' => 'SourceFile'];
     // Add the ContentSHA256 parameter.
     $docs['shapes']['ContentSHA256']['base'] = 'A SHA256 hash of the body content of the request.';
     $api['shapes']['ContentSHA256'] = ['type' => 'string'];
     $api['shapes']['PutObjectRequest']['members']['ContentSHA256'] = ['shape' => 'ContentSHA256'];
     $api['shapes']['UploadPartRequest']['members']['ContentSHA256'] = ['shape' => 'ContentSHA256'];
     unset($api['shapes']['PutObjectRequest']['members']['ContentMD5']);
     unset($api['shapes']['UploadPartRequest']['members']['ContentMD5']);
     $docs['shapes']['ContentSHA256']['append'] = $opt;
     // Add the SaveAs parameter.
     $docs['shapes']['SaveAs']['base'] = 'The path to a file on disk to save the object data.';
     $api['shapes']['SaveAs'] = ['type' => 'string'];
     $api['shapes']['GetObjectRequest']['members']['SaveAs'] = ['shape' => 'SaveAs'];
     // Several SSECustomerKey documentation updates.
     $docs['shapes']['SSECustomerKey']['append'] = $b64;
     $docs['shapes']['CopySourceSSECustomerKey']['append'] = $b64;
     $docs['shapes']['SSECustomerKeyMd5']['append'] = $opt;
     // Add the ObjectURL to various output shapes and documentation.
     $docs['shapes']['ObjectURL']['base'] = 'The URI of the created object.';
     $api['shapes']['ObjectURL'] = ['type' => 'string'];
     $api['shapes']['PutObjectOutput']['members']['ObjectURL'] = ['shape' => 'ObjectURL'];
     $api['shapes']['CopyObjectOutput']['members']['ObjectURL'] = ['shape' => 'ObjectURL'];
     $api['shapes']['CompleteMultipartUploadOutput']['members']['ObjectURL'] = ['shape' => 'ObjectURL'];
     // Fix references to Location Constraint.
     unset($api['shapes']['CreateBucketRequest']['payload']);
     $api['shapes']['BucketLocationConstraint']['enum'] = ["ap-northeast-1", "ap-southeast-2", "ap-southeast-1", "cn-north-1", "eu-central-1", "eu-west-1", "us-east-1", "us-west-1", "us-west-2", "sa-east-1"];
     // Add a note that the ContentMD5 is optional.
     $docs['shapes']['ContentMD5']['append'] = '<div class="alert alert-info">The value will be computed on ' . 'your behalf.</div>';
     return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)];
 }
 /**
  * Returns a service model and doc model with any necessary changes
  * applied.
  *
  * @param array $api  Array of service data being documented.
  * @param array $docs Array of doc model data.
  *
  * @return array Tuple containing a [Service, DocModel]
  *
  * @internal This should only used to document the service API.
  * @codeCoverageIgnore
  */
 public static function applyDocFilters(array $api, array $docs)
 {
     return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)];
 }
Ejemplo n.º 6
0
    public static function _missing_version(array $args)
    {
        $service = isset($args['service']) ? $args['service'] : '';
        $versions = ApiProvider::defaultProvider()->getVersions($service);
        $versions = implode("\n", array_map(function ($v) {
            return "* \"{$v}\"";
        }, $versions)) ?: '* (none found)';
        return <<<EOT
A "version" configuration value is required. Specifying a version constraint
ensures that your code will not be affected by a breaking change made to the
service. For example, when using Amazon S3, you can lock your API version to
"2006-03-01".

Your build of the SDK has the following version(s) of "{$service}": {$versions}

You may provide "latest" to the "version" configuration value to utilize the
most recent available API version that your client's API provider can find.
Note: Using 'latest' in a production application is not recommended.

A list of available API versions can be found on each client's API documentation
page: http://docs.aws.amazon.com/aws-sdk-php/v3/api/index.html. If you are
unable to load a specific API version, then you may need to update your copy of
the SDK.
EOT;
    }
Ejemplo n.º 7
0
 /**
  * @internal
  * @codeCoverageIgnore
  */
 public static function applyDocFilters(array $api, array $docs)
 {
     // Add the SourceFile parameter.
     $docs['shapes']['SourceFile']['base'] = 'The path to a file on disk to use instead of the body parameter.';
     $api['shapes']['SourceFile'] = ['type' => 'string'];
     $api['shapes']['UploadArchiveInput']['members']['sourceFile'] = ['shape' => 'SourceFile'];
     $api['shapes']['UploadMultipartPartInput']['members']['sourceFile'] = ['shape' => 'SourceFile'];
     // Add the ContentSHA256 parameter.
     $docs['shapes']['ContentSHA256']['base'] = 'A SHA256 hash of the content of the request body';
     $api['shapes']['ContentSHA256'] = ['type' => 'string'];
     $api['shapes']['UploadArchiveInput']['members']['contentSHA256'] = ['shape' => 'ContentSHA256'];
     $api['shapes']['UploadMultipartPartInput']['members']['contentSHA256'] = ['shape' => 'ContentSHA256'];
     // Add information about "checksum" and "ContentSHA256" being optional.
     $optional = '<div class="alert alert-info">The SDK will compute this value ' . 'for you on your behalf if it is not supplied.</div>';
     $docs['shapes']['checksum']['append'] = $optional;
     $docs['shapes']['ContentSHA256']['append'] = $optional;
     // Make "accountId" optional for all operations.
     foreach ($api['operations'] as $operation) {
         $inputShape =& $api['shapes'][$operation['input']['shape']];
         $accountIdIndex = array_search('accountId', $inputShape['required']);
         unset($inputShape['required'][$accountIdIndex]);
     }
     // Add information about the default value for "accountId".
     $optional = '<div class="alert alert-info">The SDK will set this value to "-" by default.</div>';
     foreach ($docs['shapes']['string']['refs'] as $name => &$ref) {
         if (strpos($name, 'accountId')) {
             $ref .= $optional;
         }
     }
     return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)];
 }
Ejemplo n.º 8
0
 /**
  * @internal
  * @codeCoverageIgnore
  */
 public static function applyDocFilters(array $api, array $docs)
 {
     // Add the SourceFile parameter.
     $docs['shapes']['SourceFile']['base'] = 'The path to a file on disk to use instead of the body parameter.';
     $api['shapes']['SourceFile'] = ['type' => 'string'];
     $api['shapes']['UploadArchiveInput']['members']['SourceFile'] = ['shape' => 'SourceFile'];
     $api['shapes']['UploadMultipartPartInput']['members']['SourceFile'] = ['shape' => 'SourceFile'];
     // Add information about "checksum" being optional.
     $docs['shapes']['checksum']['append'] = '<div class="alert alert-info">The SDK will compute this value ' . 'for you on your behalf if it is not supplied.</div>';
     // Add information about "accountId" being optional.
     $optional = '<div class="alert alert-info">The SDK will set this value ' . 'to "-" by default.</div>';
     foreach ($docs['shapes']['string']['refs'] as $name => &$ref) {
         if (strpos($name, 'accountId')) {
             $ref .= $optional;
         }
     }
     return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)];
 }