aws-sdk-core 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/apis/CognitoIdentity.api.json +16 -4
- data/apis/EC2.paginators.json +3 -0
- data/apis/ElastiCache.api.json +164 -15
- data/apis/IAM.api.json +326 -1
- data/apis/IAM.resources.json +2 -29
- data/apis/Route53Domains.api.json +56 -0
- data/apis/S3.api.json +1 -1
- data/endpoints.json +62 -76
- data/lib/aws-sdk-core.rb +4 -14
- data/lib/aws-sdk-core/api/documenter.rb +1 -1
- data/lib/aws-sdk-core/api/service_customizations.rb +1 -0
- data/lib/aws-sdk-core/assume_role_credentials.rb +46 -0
- data/lib/aws-sdk-core/autoscaling.rb +3 -3
- data/lib/aws-sdk-core/cloudformation.rb +3 -3
- data/lib/aws-sdk-core/cloudfront.rb +4 -4
- data/lib/aws-sdk-core/cloudsearch.rb +3 -3
- data/lib/aws-sdk-core/cloudsearchdomain.rb +2 -2
- data/lib/aws-sdk-core/cloudtrail.rb +3 -3
- data/lib/aws-sdk-core/cloudwatch.rb +3 -3
- data/lib/aws-sdk-core/cloudwatchlogs.rb +3 -3
- data/lib/aws-sdk-core/cognitoidentity.rb +2 -2
- data/lib/aws-sdk-core/cognitosync.rb +2 -2
- data/lib/aws-sdk-core/datapipeline.rb +3 -3
- data/lib/aws-sdk-core/directconnect.rb +3 -3
- data/lib/aws-sdk-core/dynamodb.rb +4 -4
- data/lib/aws-sdk-core/ec2.rb +5 -5
- data/lib/aws-sdk-core/elasticache.rb +3 -3
- data/lib/aws-sdk-core/elasticbeanstalk.rb +3 -3
- data/lib/aws-sdk-core/elasticloadbalancing.rb +3 -3
- data/lib/aws-sdk-core/elastictranscoder.rb +4 -4
- data/lib/aws-sdk-core/emr.rb +3 -3
- data/lib/aws-sdk-core/endpoint_provider.rb +16 -78
- data/lib/aws-sdk-core/glacier.rb +5 -5
- data/lib/aws-sdk-core/iam.rb +4 -4
- data/lib/aws-sdk-core/importexport.rb +3 -3
- data/lib/aws-sdk-core/instance_profile_credentials.rb +13 -45
- data/lib/aws-sdk-core/kinesis.rb +3 -3
- data/lib/aws-sdk-core/opsworks.rb +4 -4
- data/lib/aws-sdk-core/pageable_response.rb +18 -0
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +1 -5
- data/lib/aws-sdk-core/plugins/request_signer.rb +3 -9
- data/lib/aws-sdk-core/plugins/s3_region_detection.rb +157 -0
- data/lib/aws-sdk-core/plugins/stub_responses.rb +13 -1
- data/lib/aws-sdk-core/rds.rb +4 -4
- data/lib/aws-sdk-core/redshift.rb +4 -4
- data/lib/aws-sdk-core/refreshing_credentials.rb +73 -0
- data/lib/aws-sdk-core/route53.rb +3 -3
- data/lib/aws-sdk-core/route53domains.rb +2 -2
- data/lib/aws-sdk-core/s3.rb +24 -5
- data/lib/aws-sdk-core/s3/bucket_region_cache.rb +75 -0
- data/lib/aws-sdk-core/ses.rb +4 -4
- data/lib/aws-sdk-core/signers/v4.rb +1 -1
- data/lib/aws-sdk-core/simpledb.rb +3 -3
- data/lib/aws-sdk-core/sns.rb +4 -4
- data/lib/aws-sdk-core/sqs.rb +4 -4
- data/lib/aws-sdk-core/storagegateway.rb +3 -3
- data/lib/aws-sdk-core/sts.rb +2 -2
- data/lib/aws-sdk-core/support.rb +3 -3
- data/lib/aws-sdk-core/swf.rb +3 -3
- data/lib/aws-sdk-core/version.rb +1 -1
- metadata +6 -2
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:CloudTrail, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'CloudTrail.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'CloudTrail.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'CloudTrail.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:CloudWatch, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'CloudWatch.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'CloudWatch.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'CloudWatch.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:CloudWatchLogs, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'CloudWatchLogs.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'CloudWatchLogs.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'CloudWatchLogs.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,4 +1,4 @@ | |
| 1 1 | 
             
            Aws.add_service(:CognitoIdentity, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'CognitoIdentity.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'CognitoIdentity.docs.json'),
         | 
| 4 4 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:DataPipeline, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'DataPipeline.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'DataPipeline.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'DataPipeline.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:DirectConnect, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'DirectConnect.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'DirectConnect.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'DirectConnect.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            Aws.add_service(:DynamoDB, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 5 | 
            -
              waiters: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'DynamoDB.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'DynamoDB.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'DynamoDB.paginators.json'),
         | 
| 5 | 
            +
              waiters: File.join(Aws::API_DIR, 'DynamoDB.waiters.json'),
         | 
| 6 6 | 
             
            })
         | 
| 7 7 |  | 
| 8 8 | 
             
            module Aws
         | 
    
        data/lib/aws-sdk-core/ec2.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            Aws.add_service(:EC2, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 5 | 
            -
              resources: File.join(Aws:: | 
| 6 | 
            -
              waiters: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'EC2.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'EC2.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'EC2.paginators.json'),
         | 
| 5 | 
            +
              resources: File.join(Aws::API_DIR, 'EC2.resources.json'),
         | 
| 6 | 
            +
              waiters: File.join(Aws::API_DIR, 'EC2.waiters.json'),
         | 
| 7 7 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:ElastiCache, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'ElastiCache.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'ElastiCache.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'ElastiCache.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:ElasticBeanstalk, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'ElasticBeanstalk.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'ElasticBeanstalk.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'ElasticBeanstalk.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:ElasticLoadBalancing, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'ElasticLoadBalancing.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'ElasticLoadBalancing.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'ElasticLoadBalancing.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Aws.add_service(:ElasticTranscoder, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 5 | 
            -
              waiters: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'ElasticTranscoder.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'ElasticTranscoder.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'ElasticTranscoder.paginators.json'),
         | 
| 5 | 
            +
              waiters: File.join(Aws::API_DIR, 'ElasticTranscoder.waiters.json'),
         | 
| 6 6 | 
             
            })
         | 
    
        data/lib/aws-sdk-core/emr.rb
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:EMR, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'EMR.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'EMR.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'EMR.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -4,92 +4,30 @@ module Aws | |
| 4 4 | 
             
              # @api private
         | 
| 5 5 | 
             
              class EndpointProvider
         | 
| 6 6 |  | 
| 7 | 
            -
                # @ | 
| 8 | 
            -
                 | 
| 9 | 
            -
             | 
| 10 | 
            -
                 | 
| 7 | 
            +
                # @api private
         | 
| 8 | 
            +
                PATH = File.join(File.dirname(__FILE__), '..', '..', 'endpoints.json')
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                # @api private
         | 
| 11 | 
            +
                RULES = MultiJson.load(File.read(PATH))['endpoints']
         | 
| 11 12 |  | 
| 12 | 
            -
                 | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
                    if region_matches?(rule_group, options)
         | 
| 19 | 
            -
                      rule_group['rules'].each do |rule|
         | 
| 20 | 
            -
                        if service_matches?(rule, options)
         | 
| 21 | 
            -
                          return expand_endpoint(rule['config']['endpoint'], options)
         | 
| 22 | 
            -
                        end
         | 
| 13 | 
            +
                class << self
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  def resolve(region, service)
         | 
| 16 | 
            +
                    keys(region, service).each do |key|
         | 
| 17 | 
            +
                      if match = RULES[key]
         | 
| 18 | 
            +
                        return expand(match['endpoint'], region.to_s, service.to_s)
         | 
| 23 19 | 
             
                      end
         | 
| 24 20 | 
             
                    end
         | 
| 25 21 | 
             
                  end
         | 
| 26 | 
            -
                  nil
         | 
| 27 | 
            -
                end
         | 
| 28 22 |  | 
| 29 | 
            -
             | 
| 30 | 
            -
                #   optional placeholders. This is applied when rules match during
         | 
| 31 | 
            -
                #   resolution. Valid placeholders include:
         | 
| 32 | 
            -
                #
         | 
| 33 | 
            -
                #   * `{scheme}`
         | 
| 34 | 
            -
                #   * `{region}`
         | 
| 35 | 
            -
                #   * `{service}`
         | 
| 36 | 
            -
                #
         | 
| 37 | 
            -
                #   An example pattern:
         | 
| 38 | 
            -
                #
         | 
| 39 | 
            -
                #       "#{scheme}://{service}.{region}.amazonaws.com"
         | 
| 40 | 
            -
                #
         | 
| 41 | 
            -
                # @option options [Integer] :priority (100) A number from 0 to 999.
         | 
| 42 | 
            -
                #   Rules with lower number have a higher priority and are evaluated first.
         | 
| 43 | 
            -
                #
         | 
| 44 | 
            -
                # @option options [String] :region_prefix ("") Causes regions with this
         | 
| 45 | 
            -
                #   prefix to match. Leave this empty if you want to match all regions.
         | 
| 46 | 
            -
                #
         | 
| 47 | 
            -
                # @option options [Array<String>] :services A list of services this rule
         | 
| 48 | 
            -
                #   applies to. Omit this option if you want this rule to apply to all
         | 
| 49 | 
            -
                #   services.
         | 
| 50 | 
            -
                #
         | 
| 51 | 
            -
                #   The string must be the service endpoint prefix as a string.
         | 
| 52 | 
            -
                #   E.g. "s3", "ec2", "monitoring" (for cloud watch).
         | 
| 53 | 
            -
                #
         | 
| 54 | 
            -
                def add_rule(options = {})
         | 
| 55 | 
            -
                  @rules = (@rules + [new_rule(options)]).sort_by { |r| r['priority'] }
         | 
| 56 | 
            -
                end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                private
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                def new_rule(options)
         | 
| 61 | 
            -
                  rule = {}
         | 
| 62 | 
            -
                  rule['services'] = options[:services] if options[:services]
         | 
| 63 | 
            -
                  rule['config'] = {}
         | 
| 64 | 
            -
                  rule['config']['endpoint'] = options[:pattern]
         | 
| 65 | 
            -
                  {
         | 
| 66 | 
            -
                    'priority' => options[:priority] || 100,
         | 
| 67 | 
            -
                    'regionPrefix' => options[:region_prefix] || '',
         | 
| 68 | 
            -
                    'rules' => [rule]
         | 
| 69 | 
            -
                  }
         | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                def region_matches?(rule_group, options)
         | 
| 73 | 
            -
                  options[:region] && options[:region].match(/^#{rule_group['regionPrefix']}/)
         | 
| 74 | 
            -
                end
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                def service_matches?(rule, options)
         | 
| 77 | 
            -
                  rule['services'].nil? || rule['services'].include?(options[:service])
         | 
| 78 | 
            -
                end
         | 
| 79 | 
            -
             | 
| 80 | 
            -
                def expand_endpoint(pattern, options)
         | 
| 81 | 
            -
                  pattern.gsub(/{\w+}/) { |match| options[match[1..-2].to_sym] }
         | 
| 82 | 
            -
                end
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                class << self
         | 
| 23 | 
            +
                  private
         | 
| 85 24 |  | 
| 86 | 
            -
                  def  | 
| 87 | 
            -
                     | 
| 25 | 
            +
                  def keys(region, service)
         | 
| 26 | 
            +
                    ["#{region}/#{service}", "#{region}/*", "*/#{service}", "*/*"]
         | 
| 88 27 | 
             
                  end
         | 
| 89 28 |  | 
| 90 | 
            -
                  def  | 
| 91 | 
            -
                     | 
| 92 | 
            -
                    MultiJson.load(File.read(path))
         | 
| 29 | 
            +
                  def expand(pattern, region, service)
         | 
| 30 | 
            +
                    'https://' + pattern.sub('{region}', region).sub('{service}', service)
         | 
| 93 31 | 
             
                  end
         | 
| 94 32 |  | 
| 95 33 | 
             
                end
         | 
    
        data/lib/aws-sdk-core/glacier.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            Aws.add_service(:Glacier, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 5 | 
            -
              resources: File.join(Aws:: | 
| 6 | 
            -
              waiters: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'Glacier.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'Glacier.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'Glacier.paginators.json'),
         | 
| 5 | 
            +
              resources: File.join(Aws::API_DIR, 'Glacier.resources.json'),
         | 
| 6 | 
            +
              waiters: File.join(Aws::API_DIR, 'Glacier.waiters.json'),
         | 
| 7 7 | 
             
            })
         | 
    
        data/lib/aws-sdk-core/iam.rb
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Aws.add_service(:IAM, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 5 | 
            -
              resources: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'IAM.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'IAM.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'IAM.paginators.json'),
         | 
| 5 | 
            +
              resources: File.join(Aws::API_DIR, 'IAM.resources.json'),
         | 
| 6 6 | 
             
            })
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:ImportExport, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'ImportExport.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'ImportExport.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'ImportExport.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,10 +1,11 @@ | |
| 1 1 | 
             
            require 'time'
         | 
| 2 2 | 
             
            require 'net/http'
         | 
| 3 | 
            -
            require 'thread'
         | 
| 4 3 |  | 
| 5 4 | 
             
            module Aws
         | 
| 6 5 | 
             
              class InstanceProfileCredentials < Credentials
         | 
| 7 6 |  | 
| 7 | 
            +
                include RefreshingCredentials
         | 
| 8 | 
            +
             | 
| 8 9 | 
             
                # @api private
         | 
| 9 10 | 
             
                class Non200Response < RuntimeError; end
         | 
| 10 11 |  | 
| @@ -38,58 +39,25 @@ module Aws | |
| 38 39 | 
             
                  @http_open_timeout = options[:http_open_timeout] || 1
         | 
| 39 40 | 
             
                  @http_read_timeout = options[:http_read_timeout] || 1
         | 
| 40 41 | 
             
                  @http_debug_output = options[:http_debug_output]
         | 
| 41 | 
            -
                   | 
| 42 | 
            -
                  refresh!
         | 
| 42 | 
            +
                  super
         | 
| 43 43 | 
             
                end
         | 
| 44 44 |  | 
| 45 45 | 
             
                # @return [Integer] The number of times to retry failed atttempts to
         | 
| 46 46 | 
             
                #   fetch credentials from the instance metadata service. Defaults to 0.
         | 
| 47 47 | 
             
                attr_reader :retries
         | 
| 48 48 |  | 
| 49 | 
            -
                # @return [String,nil]
         | 
| 50 | 
            -
                def access_key_id
         | 
| 51 | 
            -
                  refresh_if_stale
         | 
| 52 | 
            -
                  @access_key_id
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                # @return [String,nil]
         | 
| 56 | 
            -
                def secret_access_key
         | 
| 57 | 
            -
                  refresh_if_stale
         | 
| 58 | 
            -
                  @secret_access_key
         | 
| 59 | 
            -
                end
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                # @return [String,nil]
         | 
| 62 | 
            -
                def session_token
         | 
| 63 | 
            -
                  refresh_if_stale
         | 
| 64 | 
            -
                  @session_token
         | 
| 65 | 
            -
                end
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                # @return [Time,nil]
         | 
| 68 | 
            -
                def expiration
         | 
| 69 | 
            -
                  refresh_if_stale
         | 
| 70 | 
            -
                  @expiration
         | 
| 71 | 
            -
                end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                def refresh!
         | 
| 74 | 
            -
                  @refresh_mutex.synchronize do
         | 
| 75 | 
            -
                    credentials = MultiJson.load(get_credentials)
         | 
| 76 | 
            -
                    @access_key_id = credentials['AccessKeyId']
         | 
| 77 | 
            -
                    @secret_access_key = credentials['SecretAccessKey']
         | 
| 78 | 
            -
                    @session_token = credentials['Token']
         | 
| 79 | 
            -
                    if expires = credentials['Expiration']
         | 
| 80 | 
            -
                      @expiration = Time.parse(expires)
         | 
| 81 | 
            -
                    else
         | 
| 82 | 
            -
                      @expiration = nil
         | 
| 83 | 
            -
                    end
         | 
| 84 | 
            -
                  end
         | 
| 85 | 
            -
                end
         | 
| 86 | 
            -
             | 
| 87 49 | 
             
                private
         | 
| 88 50 |  | 
| 89 | 
            -
                 | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
                   | 
| 51 | 
            +
                def refresh
         | 
| 52 | 
            +
                  credentials = MultiJson.load(get_credentials)
         | 
| 53 | 
            +
                  @access_key_id = credentials['AccessKeyId']
         | 
| 54 | 
            +
                  @secret_access_key = credentials['SecretAccessKey']
         | 
| 55 | 
            +
                  @session_token = credentials['Token']
         | 
| 56 | 
            +
                  if expires = credentials['Expiration']
         | 
| 57 | 
            +
                    @expiration = Time.parse(expires)
         | 
| 58 | 
            +
                  else
         | 
| 59 | 
            +
                    @expiration = nil
         | 
| 60 | 
            +
                  end
         | 
| 93 61 | 
             
                end
         | 
| 94 62 |  | 
| 95 63 | 
             
                def get_credentials
         | 
    
        data/lib/aws-sdk-core/kinesis.rb
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            Aws.add_service(:Kinesis, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'Kinesis.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'Kinesis.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'Kinesis.paginators.json'),
         | 
| 5 5 | 
             
            })
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Aws.add_service(:OpsWorks, {
         | 
| 2 | 
            -
              api: File.join(Aws:: | 
| 3 | 
            -
              docs: File.join(Aws:: | 
| 4 | 
            -
              paginators: File.join(Aws:: | 
| 5 | 
            -
              resources: File.join(Aws:: | 
| 2 | 
            +
              api: File.join(Aws::API_DIR, 'OpsWorks.api.json'),
         | 
| 3 | 
            +
              docs: File.join(Aws::API_DIR, 'OpsWorks.docs.json'),
         | 
| 4 | 
            +
              paginators: File.join(Aws::API_DIR, 'OpsWorks.paginators.json'),
         | 
| 5 | 
            +
              resources: File.join(Aws::API_DIR, 'OpsWorks.resources.json'),
         | 
| 6 6 | 
             
            })
         | 
| @@ -84,6 +84,24 @@ module Aws | |
| 84 84 | 
             
                end
         | 
| 85 85 | 
             
                alias each each_page
         | 
| 86 86 |  | 
| 87 | 
            +
                # @api private
         | 
| 88 | 
            +
                def count
         | 
| 89 | 
            +
                  if respond_to?(:count)
         | 
| 90 | 
            +
                    data.count
         | 
| 91 | 
            +
                  else
         | 
| 92 | 
            +
                    raise NotImplementedError
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
                end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                # @api private
         | 
| 97 | 
            +
                def respond_to?(method_name, *args)
         | 
| 98 | 
            +
                  if method_name == :count
         | 
| 99 | 
            +
                    data.respond_to?(:count)
         | 
| 100 | 
            +
                  else
         | 
| 101 | 
            +
                    super
         | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
             | 
| 87 105 | 
             
                private
         | 
| 88 106 |  | 
| 89 107 | 
             
                # @param [Hash] params A hash of additional request params to
         | 
| @@ -20,11 +20,7 @@ module Aws | |
| 20 20 | 
             
                  }
         | 
| 21 21 |  | 
| 22 22 | 
             
                  option(:endpoint) do |cfg|
         | 
| 23 | 
            -
                    EndpointProvider. | 
| 24 | 
            -
                      service: cfg.api.metadata('endpointPrefix'),
         | 
| 25 | 
            -
                      region: cfg.region,
         | 
| 26 | 
            -
                      scheme: 'https'
         | 
| 27 | 
            -
                    )
         | 
| 23 | 
            +
                    EndpointProvider.resolve(cfg.region, cfg.api.metadata('endpointPrefix'))
         | 
| 28 24 | 
             
                  end
         | 
| 29 25 |  | 
| 30 26 | 
             
                  def after_initialize(client)
         | 
| @@ -40,14 +40,7 @@ module Aws | |
| 40 40 | 
             
                  # Intentionally not documented - this should go away when all
         | 
| 41 41 | 
             
                  # services support signature version 4 in every region.
         | 
| 42 42 | 
             
                  option(:signature_version) do |cfg|
         | 
| 43 | 
            -
                     | 
| 44 | 
            -
                      cfg.api.metadata('endpointPrefix') == 's3' &&
         | 
| 45 | 
            -
                      cfg.api.metadata('v3Regions').include?(cfg.region)
         | 
| 46 | 
            -
                    then
         | 
| 47 | 
            -
                      's3'
         | 
| 48 | 
            -
                    else
         | 
| 49 | 
            -
                      cfg.api.metadata('signatureVersion')
         | 
| 50 | 
            -
                    end
         | 
| 43 | 
            +
                    cfg.api.metadata('signatureVersion')
         | 
| 51 44 | 
             
                  end
         | 
| 52 45 |  | 
| 53 46 | 
             
                  option(:sigv4_name) do |cfg|
         | 
| @@ -82,7 +75,8 @@ module Aws | |
| 82 75 | 
             
                    private
         | 
| 83 76 |  | 
| 84 77 | 
             
                    def sign_authenticated_requests(context)
         | 
| 85 | 
            -
                       | 
| 78 | 
            +
                      version = context[:signature_version] || context.config.signature_version
         | 
| 79 | 
            +
                      if signer = SIGNERS[version]
         | 
| 86 80 | 
             
                        require_credentials(context)
         | 
| 87 81 | 
             
                        signer.sign(context)
         | 
| 88 82 | 
             
                      end
         |