Вход Регистрация
Файл: sngine-v2.8/Script/includes/libs/AWS/Aws/CloudFront/CloudFrontClient.php
Строк: 496
<?php
namespace AwsCloudFront;

use 
AwsAwsClient;

/**
 * This client is used to interact with the **Amazon CloudFront** service.
 *
 * @method AwsResult createCloudFrontOriginAccessIdentity(array $args = [])
 * @method GuzzleHttpPromisePromise createCloudFrontOriginAccessIdentityAsync(array $args = [])
 * @method AwsResult createDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise createDistributionAsync(array $args = [])
 * @method AwsResult createInvalidation(array $args = [])
 * @method GuzzleHttpPromisePromise createInvalidationAsync(array $args = [])
 * @method AwsResult createStreamingDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise createStreamingDistributionAsync(array $args = [])
 * @method AwsResult deleteCloudFrontOriginAccessIdentity(array $args = [])
 * @method GuzzleHttpPromisePromise deleteCloudFrontOriginAccessIdentityAsync(array $args = [])
 * @method AwsResult deleteDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise deleteDistributionAsync(array $args = [])
 * @method AwsResult deleteStreamingDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise deleteStreamingDistributionAsync(array $args = [])
 * @method AwsResult getCloudFrontOriginAccessIdentity(array $args = [])
 * @method GuzzleHttpPromisePromise getCloudFrontOriginAccessIdentityAsync(array $args = [])
 * @method AwsResult getCloudFrontOriginAccessIdentityConfig(array $args = [])
 * @method GuzzleHttpPromisePromise getCloudFrontOriginAccessIdentityConfigAsync(array $args = [])
 * @method AwsResult getDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise getDistributionAsync(array $args = [])
 * @method AwsResult getDistributionConfig(array $args = [])
 * @method GuzzleHttpPromisePromise getDistributionConfigAsync(array $args = [])
 * @method AwsResult getInvalidation(array $args = [])
 * @method GuzzleHttpPromisePromise getInvalidationAsync(array $args = [])
 * @method AwsResult getStreamingDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise getStreamingDistributionAsync(array $args = [])
 * @method AwsResult getStreamingDistributionConfig(array $args = [])
 * @method GuzzleHttpPromisePromise getStreamingDistributionConfigAsync(array $args = [])
 * @method AwsResult listCloudFrontOriginAccessIdentities(array $args = [])
 * @method GuzzleHttpPromisePromise listCloudFrontOriginAccessIdentitiesAsync(array $args = [])
 * @method AwsResult listDistributions(array $args = [])
 * @method GuzzleHttpPromisePromise listDistributionsAsync(array $args = [])
 * @method AwsResult listDistributionsByWebACLId(array $args = [])
 * @method GuzzleHttpPromisePromise listDistributionsByWebACLIdAsync(array $args = [])
 * @method AwsResult listInvalidations(array $args = [])
 * @method GuzzleHttpPromisePromise listInvalidationsAsync(array $args = [])
 * @method AwsResult listStreamingDistributions(array $args = [])
 * @method GuzzleHttpPromisePromise listStreamingDistributionsAsync(array $args = [])
 * @method AwsResult updateCloudFrontOriginAccessIdentity(array $args = [])
 * @method GuzzleHttpPromisePromise updateCloudFrontOriginAccessIdentityAsync(array $args = [])
 * @method AwsResult updateDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise updateDistributionAsync(array $args = [])
 * @method AwsResult updateStreamingDistribution(array $args = [])
 * @method GuzzleHttpPromisePromise updateStreamingDistributionAsync(array $args = [])
 * @method AwsResult createDistributionWithTags(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise createDistributionWithTagsAsync(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult createStreamingDistributionWithTags(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise createStreamingDistributionWithTagsAsync(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult listTagsForResource(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise listTagsForResourceAsync(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult tagResource(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise tagResourceAsync(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult untagResource(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise untagResourceAsync(array $args = []) (supported in versions 2016-08-01, 2016-08-20, 2016-09-07, 2016-09-29, 2016-11-25, 2017-03-25, 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult deleteServiceLinkedRole(array $args = []) (supported in versions 2017-03-25)
 * @method GuzzleHttpPromisePromise deleteServiceLinkedRoleAsync(array $args = []) (supported in versions 2017-03-25)
 * @method AwsResult createFieldLevelEncryptionConfig(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise createFieldLevelEncryptionConfigAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult createFieldLevelEncryptionProfile(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise createFieldLevelEncryptionProfileAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult createPublicKey(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise createPublicKeyAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult deleteFieldLevelEncryptionConfig(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise deleteFieldLevelEncryptionConfigAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult deleteFieldLevelEncryptionProfile(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise deleteFieldLevelEncryptionProfileAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult deletePublicKey(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise deletePublicKeyAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult getFieldLevelEncryption(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise getFieldLevelEncryptionAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult getFieldLevelEncryptionConfig(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise getFieldLevelEncryptionConfigAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult getFieldLevelEncryptionProfile(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise getFieldLevelEncryptionProfileAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult getFieldLevelEncryptionProfileConfig(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise getFieldLevelEncryptionProfileConfigAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult getPublicKey(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise getPublicKeyAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult getPublicKeyConfig(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise getPublicKeyConfigAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult listFieldLevelEncryptionConfigs(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise listFieldLevelEncryptionConfigsAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult listFieldLevelEncryptionProfiles(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise listFieldLevelEncryptionProfilesAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult listPublicKeys(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise listPublicKeysAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult updateFieldLevelEncryptionConfig(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise updateFieldLevelEncryptionConfigAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult updateFieldLevelEncryptionProfile(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise updateFieldLevelEncryptionProfileAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method AwsResult updatePublicKey(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 * @method GuzzleHttpPromisePromise updatePublicKeyAsync(array $args = []) (supported in versions 2017-10-30, 2018-06-18, 2018-11-05, 2019-03-26)
 */
class CloudFrontClient extends AwsClient
{
    
/**
     * Create a signed Amazon CloudFront URL.
     *
     * 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 Signed URL with authentication parameters
     * @throws InvalidArgumentException if url, key_pair_id, or private_key
     *     were not specified.
     * @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html
     */
    
public function getSignedUrl(array $options)
    {
        foreach ([
'url''key_pair_id''private_key'] as $required) {
            if (!isset(
$options[$required])) {
                throw new 
InvalidArgumentException("$required is required");
            }
        }

        
$urlSigner = new UrlSigner(
            
$options['key_pair_id'],
            
$options['private_key']
        );

        return 
$urlSigner->getSignedUrl(
            
$options['url'],
            isset(
$options['expires']) ? $options['expires'] : null,
            isset(
$options['policy']) ? $options['policy'] : null
        
);
    }

    
/**
     * Create a signed Amazon CloudFront cookie.
     *
     * This method accepts an array of configuration options:
     *
     * - url: (string)  URL of the resource being signed (can include query
     *   string and wildcards). For example: 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 array Key => value pairs of signed cookies to set
     * @throws InvalidArgumentException if url, key_pair_id, or private_key
     *     were not specified.
     * @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html
     */
    
public function getSignedCookie(array $options)
    {
        foreach ([
'key_pair_id''private_key'] as $required) {
            if (!isset(
$options[$required])) {
                throw new 
InvalidArgumentException("$required is required");
            }
        }

        
$cookieSigner = new CookieSigner(
            
$options['key_pair_id'],
            
$options['private_key']
        );

        return 
$cookieSigner->getSignedCookie(
            isset(
$options['url']) ? $options['url'] : null,
            isset(
$options['expires']) ? $options['expires'] : null,
            isset(
$options['policy']) ? $options['policy'] : null
        
);
    }
}
Онлайн: 0
Реклама