fog-aws 0.11.0 → 0.12.0
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/CHANGELOG.md +22 -1
- data/lib/fog/aws.rb +2 -0
- data/lib/fog/aws/cloud_formation.rb +14 -0
- data/lib/fog/aws/compute.rb +2 -0
- data/lib/fog/aws/models/compute/security_group.rb +49 -26
- data/lib/fog/aws/models/compute/vpc.rb +6 -0
- data/lib/fog/aws/models/support/flagged_resource.rb +14 -0
- data/lib/fog/aws/models/support/flagged_resources.rb +11 -0
- data/lib/fog/aws/models/support/trusted_advisor_check.rb +65 -0
- data/lib/fog/aws/models/support/trusted_advisor_checks.rb +21 -0
- data/lib/fog/aws/parsers/cloud_formation/basic.rb +8 -0
- data/lib/fog/aws/parsers/cloud_formation/create_change_set.rb +16 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_account_limits.rb +26 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_change_set.rb +135 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_resource.rb +28 -0
- data/lib/fog/aws/parsers/cloud_formation/estimate_template_cost.rb +16 -0
- data/lib/fog/aws/parsers/cloud_formation/get_stack_policy.rb +16 -0
- data/lib/fog/aws/parsers/cloud_formation/get_template_summary.rb +62 -0
- data/lib/fog/aws/parsers/cloud_formation/list_change_sets.rb +30 -0
- data/lib/fog/aws/parsers/compute/describe_vpcs.rb +3 -1
- data/lib/fog/aws/requests/cloud_formation/cancel_update_stack.rb +25 -0
- data/lib/fog/aws/requests/cloud_formation/continue_update_rollback.rb +26 -0
- data/lib/fog/aws/requests/cloud_formation/create_change_set.rb +70 -0
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +14 -0
- data/lib/fog/aws/requests/cloud_formation/delete_change_set.rb +26 -0
- data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +1 -1
- data/lib/fog/aws/requests/cloud_formation/describe_account_limits.rb +27 -0
- data/lib/fog/aws/requests/cloud_formation/describe_change_set.rb +43 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_resource.rb +40 -0
- data/lib/fog/aws/requests/cloud_formation/estimate_template_cost.rb +48 -0
- data/lib/fog/aws/requests/cloud_formation/execute_change_set.rb +26 -0
- data/lib/fog/aws/requests/cloud_formation/get_stack_policy.rb +27 -0
- data/lib/fog/aws/requests/cloud_formation/get_template_summary.rb +46 -0
- data/lib/fog/aws/requests/cloud_formation/list_change_sets.rb +40 -0
- data/lib/fog/aws/requests/cloud_formation/set_stack_policy.rb +38 -0
- data/lib/fog/aws/requests/cloud_formation/signal_resource.rb +32 -0
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +49 -0
- data/lib/fog/aws/requests/compute/authorize_security_group_egress.rb +112 -0
- data/lib/fog/aws/requests/compute/revoke_security_group_egress.rb +98 -0
- data/lib/fog/aws/requests/support/describe_trusted_advisor_check_result.rb +31 -0
- data/lib/fog/aws/requests/support/describe_trusted_advisor_checks.rb +29 -0
- data/lib/fog/aws/support.rb +170 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/models/compute/security_group_tests.rb +24 -0
- data/tests/models/support/trusted_advisor_tests.rb +25 -0
- data/tests/requests/support/helper.rb +43 -0
- data/tests/requests/support/trusted_advisor_check_tests.rb +16 -0
- metadata +36 -3
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module AWS
         | 
| 3 | 
            +
                class Support
         | 
| 4 | 
            +
                  class Real
         | 
| 5 | 
            +
                    # Describe Trusted Advisor Check Result
         | 
| 6 | 
            +
                    # http://docs.aws.amazon.com/awssupport/latest/APIReference/API_DescribeTrustedAdvisorCheckResult.html
         | 
| 7 | 
            +
                    # ==== Parameters
         | 
| 8 | 
            +
                    # * checkId <~String>  - Id of the check obtained from #describe_trusted_advisor_checks
         | 
| 9 | 
            +
                    # * language <~String> - Language to return.  Supported values are 'en' and 'jp'
         | 
| 10 | 
            +
                    # ==== Returns
         | 
| 11 | 
            +
                    # * response<~Excon::Response>:
         | 
| 12 | 
            +
                    #   * body<~Hash>
         | 
| 13 | 
            +
                    def describe_trusted_advisor_check_result(options={})
         | 
| 14 | 
            +
                      request(
         | 
| 15 | 
            +
                        'Action'   => 'DescribeTrustedAdvisorCheckResult',
         | 
| 16 | 
            +
                        'checkId'  => options[:id],
         | 
| 17 | 
            +
                        'language' => options[:language] || 'en'
         | 
| 18 | 
            +
                      )
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  class Mock
         | 
| 23 | 
            +
                    def describe_trusted_advisor_check_result(options={})
         | 
| 24 | 
            +
                      response = Excon::Response.new
         | 
| 25 | 
            +
                      response.body = {'result' => self.data[:trusted_advisor_check_results][options[:id]]}
         | 
| 26 | 
            +
                      response
         | 
| 27 | 
            +
                    end
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module AWS
         | 
| 3 | 
            +
                class Support
         | 
| 4 | 
            +
                  class Real
         | 
| 5 | 
            +
                    # Describe Trusted Advisor Checks
         | 
| 6 | 
            +
                    # http://docs.aws.amazon.com/awssupport/latest/APIReference/API_DescribeTrustedAdvisorChecks.html
         | 
| 7 | 
            +
                    # ==== Parameters
         | 
| 8 | 
            +
                    # * language <~String> - Language to return.  Supported values are 'en' and 'jp'
         | 
| 9 | 
            +
                    # ==== Returns
         | 
| 10 | 
            +
                    # * response<~Excon::Response>:
         | 
| 11 | 
            +
                    #   * body<~Hash>
         | 
| 12 | 
            +
                    def describe_trusted_advisor_checks(options={})
         | 
| 13 | 
            +
                      request(
         | 
| 14 | 
            +
                        'Action'   => 'DescribeTrustedAdvisorChecks',
         | 
| 15 | 
            +
                        'language' => options[:language] || 'en'
         | 
| 16 | 
            +
                      )
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  class Mock
         | 
| 21 | 
            +
                    def describe_trusted_advisor_checks(options={})
         | 
| 22 | 
            +
                      response = Excon::Response.new
         | 
| 23 | 
            +
                      response.body = {'checks' => self.data[:trusted_advisor_checks].values}
         | 
| 24 | 
            +
                      response
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
| @@ -0,0 +1,170 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module AWS
         | 
| 3 | 
            +
                class Support < Fog::Service
         | 
| 4 | 
            +
                  extend Fog::AWS::CredentialFetcher::ServiceMethods
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  requires :aws_access_key_id, :aws_secret_access_key
         | 
| 7 | 
            +
                  recognizes :host, :path, :port, :scheme, :instrumentor, :instrumentor_name, :region, :persistent, :aws_session_token
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  model_path 'fog/aws/models/support'
         | 
| 10 | 
            +
                  request_path 'fog/aws/requests/support'
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  collection :flagged_resources
         | 
| 13 | 
            +
                  collection :trusted_advisor_checks
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  model :flagged_resource
         | 
| 16 | 
            +
                  model :trusted_advisor_check
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  request :describe_trusted_advisor_checks
         | 
| 19 | 
            +
                  request :describe_trusted_advisor_check_result
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  class Mock
         | 
| 22 | 
            +
                    def self.data
         | 
| 23 | 
            +
                      @data ||= Hash.new do |hash, region|
         | 
| 24 | 
            +
                        hash[region] = Hash.new do |region_hash, key|
         | 
| 25 | 
            +
                          tac_id = Fog::Mock.random_hex(5)
         | 
| 26 | 
            +
                          region_hash[key] = {
         | 
| 27 | 
            +
                            :trusted_advisor_checks => {
         | 
| 28 | 
            +
                              tac_id => {
         | 
| 29 | 
            +
                                "category"=>"cost_optimizing",
         | 
| 30 | 
            +
                                "description"=>"Checks the Amazon Elastic Compute Cloud (Amazon EC2) instances that were running at any time during the last 14 days and alerts you if the daily CPU utilization was 10% or less and network I/O was 5 MB or less on 4 or more days. Running instances generate hourly usage charges. Although some scenarios can result in low utilization by design, you can often lower your costs by managing the number and size of your instances.\n<br><br>\nEstimated monthly savings are calculated by using the current usage rate for On-Demand Instances and the estimated number of days the instance might be underutilized. Actual savings will vary if you are using Reserved Instances or Spot Instances, or if the instance is not running for a full day. To get daily utilization data, download the report for this check. \n<br>\n<br>\n<b>Alert Criteria</b><br>\nYellow: An instance had 10% or less daily average CPU utilization and 5 MB or less network I/O on at least 4 of the previous 14 days.<br>\n<br>\n<b>Recommended Action</b><br>\nConsider stopping or terminating instances that have low utilization, or scale the number of instances by using Auto Scaling. For more information, see <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html\" target=\"_blank\">Stop and Start Your Instance</a>, <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html\" target=\"_blank\">Terminate Your Instance</a>, and <a href=\"http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/WhatIsAutoScaling.html\" target=\"_blank\">What is Auto Scaling?</a><br>\n<br>\n<b>Additional Resources</b><br>\n<a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-monitoring.html\" target=\"_blank\">Monitoring Amazon EC2</a><br>\n<a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html\" target=\"_blank\">Instance Metadata and User Data</a><br>\n<a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/Welcome.html\" target=\"_blank\">Amazon CloudWatch Developer Guide</a><br>\n<a href=\"http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/WhatIsAutoScaling.html\" target=\"_blank\">Auto Scaling Developer Guide</a>",
         | 
| 31 | 
            +
                                "id"=>tac_id,
         | 
| 32 | 
            +
                                "metadata"=>["Region/AZ", "Instance ID", "Instance Name", "Instance Type", "Estimated Monthly Savings", "Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6", "Day 7", "Day 8", "Day 9", "Day 10", "Day 11", "Day 12", "Day 13", "Day 14", "14-Day Average CPU Utilization", "14-Day Average Network I/O", "Number of Days Low Utilization"],
         | 
| 33 | 
            +
                                "name"=>"Low Utilization Amazon EC2 Instances"
         | 
| 34 | 
            +
                              }
         | 
| 35 | 
            +
                            },
         | 
| 36 | 
            +
                            :trusted_advisor_check_results => {
         | 
| 37 | 
            +
                              tac_id => {
         | 
| 38 | 
            +
                                'checkId'          => tac_id,
         | 
| 39 | 
            +
                                'status'           => "warning",
         | 
| 40 | 
            +
                                'timestamp'        => "2016-09-18T13:19:35Z",
         | 
| 41 | 
            +
                                'resourcesSummary' => {
         | 
| 42 | 
            +
                                  "resourcesFlagged"    => 40,
         | 
| 43 | 
            +
                                  "resourcesIgnored"    => 0,
         | 
| 44 | 
            +
                                  "resourcesProcessed"  => 47,
         | 
| 45 | 
            +
                                  "resourcesSuppressed" => 0
         | 
| 46 | 
            +
                                },
         | 
| 47 | 
            +
                                'categorySpecificSummary' => {
         | 
| 48 | 
            +
                                  "costOptimizing" => {
         | 
| 49 | 
            +
                                    "estimatedMonthlySavings"        => 4156.920000000003,
         | 
| 50 | 
            +
                                    "estimatedPercentMonthlySavings" => 0.9918398900532555
         | 
| 51 | 
            +
                                  }
         | 
| 52 | 
            +
                                },
         | 
| 53 | 
            +
                                'flaggedResources' => [{
         | 
| 54 | 
            +
                                  "region"       => "us-west-2",
         | 
| 55 | 
            +
                                  "resourceId"   => Fog::Mock.random_hex(22),
         | 
| 56 | 
            +
                                  "status"       => "warning",
         | 
| 57 | 
            +
                                  "isSuppressed" => false,
         | 
| 58 | 
            +
                                  "metadata"     => ["us-west-2a", "i-#{Fog::Mock.random_hex(5)}", "instance_tags", "m3.large", "$95.76", "2.3%  0.23MB", "2.3%  0.20MB", "2.3%  0.21MB", "2.4%  0.28MB", "2.3%  0.20MB", "2.3%  0.20MB", "2.3%  0.20MB", "2.3%  0.20MB", "2.3%  0.20MB", "2.3%  0.20MB", "2.6%  0.54MB", "2.4%  0.31MB", "2.3%  0.21MB", "2.3%  0.20MB", "2.3%", "0.24MB", "14 days"]
         | 
| 59 | 
            +
                                }]
         | 
| 60 | 
            +
                              }
         | 
| 61 | 
            +
                            }
         | 
| 62 | 
            +
                          }
         | 
| 63 | 
            +
                        end
         | 
| 64 | 
            +
                      end
         | 
| 65 | 
            +
                    end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                    def self.reset
         | 
| 68 | 
            +
                      @data = nil
         | 
| 69 | 
            +
                    end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                    def reset
         | 
| 72 | 
            +
                      self.class.reset
         | 
| 73 | 
            +
                    end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                    attr_accessor :region
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                    def initialize(options={})
         | 
| 78 | 
            +
                      @region = 'us-east-1'
         | 
| 79 | 
            +
                    end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                    def data
         | 
| 82 | 
            +
                      self.class.data[@region][@aws_access_key_id]
         | 
| 83 | 
            +
                    end
         | 
| 84 | 
            +
                  end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                  class Real
         | 
| 87 | 
            +
                    include Fog::AWS::CredentialFetcher::ConnectionMethods
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                    def initialize(options={})
         | 
| 90 | 
            +
                      @connection_options = options[:connection_options] || {}
         | 
| 91 | 
            +
                      @instrumentor       = options[:instrumentor]
         | 
| 92 | 
            +
                      @instrumentor_name  = options[:instrumentor_name] || 'fog.aws.support'
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                      @region     = 'us-east-1'
         | 
| 95 | 
            +
                      @host       = options[:host]       || "support.#{@region}.amazonaws.com"
         | 
| 96 | 
            +
                      @path       = options[:path]       || "/"
         | 
| 97 | 
            +
                      @port       = options[:port]       || 443
         | 
| 98 | 
            +
                      @scheme     = options[:scheme]     || "https"
         | 
| 99 | 
            +
                      @persistent = options[:persistent] || false
         | 
| 100 | 
            +
                      @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
         | 
| 101 | 
            +
                      @version    = options[:version]    || '2013-04-15'
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                      setup_credentials(options)
         | 
| 104 | 
            +
                    end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                    def reload
         | 
| 107 | 
            +
                      @connection.reset
         | 
| 108 | 
            +
                    end
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                    def setup_credentials(options)
         | 
| 111 | 
            +
                      @aws_access_key_id         = options[:aws_access_key_id]
         | 
| 112 | 
            +
                      @aws_secret_access_key     = options[:aws_secret_access_key]
         | 
| 113 | 
            +
                      @aws_session_token         = options[:aws_session_token]
         | 
| 114 | 
            +
                      @aws_credentials_expire_at = options[:aws_credentials_expire_at]
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                      #global services that have no region are signed with the us-east-1 region
         | 
| 117 | 
            +
                      #the only exception is GovCloud, which requires the region to be explicitly specified as us-gov-west-1
         | 
| 118 | 
            +
                      @signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, @region, 'support')
         | 
| 119 | 
            +
                    end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                    def request(params)
         | 
| 122 | 
            +
                      refresh_credentials_if_expired
         | 
| 123 | 
            +
                      idempotent   = params.delete(:idempotent)
         | 
| 124 | 
            +
                      parser       = params.delete(:parser)
         | 
| 125 | 
            +
                      action       = params.delete('Action')
         | 
| 126 | 
            +
                      request_body = Fog::JSON.encode(params)
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                      body, headers = Fog::AWS.signed_params_v4(
         | 
| 129 | 
            +
                        params,
         | 
| 130 | 
            +
                        {
         | 
| 131 | 
            +
                          'Content-Type' => "application/x-amz-json-1.1",
         | 
| 132 | 
            +
                          "X-Amz-Target" => "AWSSupport_#{@version.gsub("-", "")}.#{action}"
         | 
| 133 | 
            +
                        },
         | 
| 134 | 
            +
                        {
         | 
| 135 | 
            +
                          :host               => @host,
         | 
| 136 | 
            +
                          :path               => @path,
         | 
| 137 | 
            +
                          :port               => @port,
         | 
| 138 | 
            +
                          :version            => @version,
         | 
| 139 | 
            +
                          :signer             => @signer,
         | 
| 140 | 
            +
                          :aws_session_token  => @aws_session_token,
         | 
| 141 | 
            +
                          :method             => 'POST',
         | 
| 142 | 
            +
                          :body               => request_body
         | 
| 143 | 
            +
                        }
         | 
| 144 | 
            +
                      )
         | 
| 145 | 
            +
             | 
| 146 | 
            +
                      if @instrumentor
         | 
| 147 | 
            +
                        @instrumentor.instrument("#{@instrumentor_name}.request", params) do
         | 
| 148 | 
            +
                          _request(body, headers, idempotent, parser)
         | 
| 149 | 
            +
                        end
         | 
| 150 | 
            +
                      else
         | 
| 151 | 
            +
                        _request(body, headers, idempotent, parser)
         | 
| 152 | 
            +
                      end
         | 
| 153 | 
            +
                    end
         | 
| 154 | 
            +
             | 
| 155 | 
            +
                    def _request(body, headers, idempotent, parser)
         | 
| 156 | 
            +
                      response = @connection.request({
         | 
| 157 | 
            +
                        :body       => body,
         | 
| 158 | 
            +
                        :expects    => 200,
         | 
| 159 | 
            +
                        :idempotent => idempotent,
         | 
| 160 | 
            +
                        :headers    => headers,
         | 
| 161 | 
            +
                        :method     => 'POST',
         | 
| 162 | 
            +
                        :parser     => parser
         | 
| 163 | 
            +
                      })
         | 
| 164 | 
            +
                      response.body = Fog::JSON.decode(response.body)
         | 
| 165 | 
            +
                      response
         | 
| 166 | 
            +
                    end
         | 
| 167 | 
            +
                  end
         | 
| 168 | 
            +
                end
         | 
| 169 | 
            +
              end
         | 
| 170 | 
            +
            end
         | 
    
        data/lib/fog/aws/version.rb
    CHANGED
    
    
| @@ -35,6 +35,30 @@ Shindo.tests("Fog::Compute[:aws] | security_group", ['aws']) do | |
| 35 35 | 
             
                  @group.ip_permissions.empty?
         | 
| 36 36 | 
             
                end
         | 
| 37 37 |  | 
| 38 | 
            +
                test("authorize access at a port range (egress rule)") do
         | 
| 39 | 
            +
                  @group.authorize_port_range(5000..6000, :direction => 'egress')
         | 
| 40 | 
            +
                  @group.reload
         | 
| 41 | 
            +
                  ip_permission_egress = @group.ip_permissions_egress.find do |permission|
         | 
| 42 | 
            +
                    permission['fromPort'] == 5000 &&
         | 
| 43 | 
            +
                      permission['toPort'] == 6000 &&
         | 
| 44 | 
            +
                      permission['ipProtocol'] == 'tcp' &&
         | 
| 45 | 
            +
                      permission['ipRanges'] == [{ 'cidrIp' => '0.0.0.0/0' }]
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
                  !ip_permission_egress.nil?
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                test("revoke access at a port range (egress rule)") do
         | 
| 51 | 
            +
                  @group.revoke_port_range(5000..6000, :direction => 'egress')
         | 
| 52 | 
            +
                  @group.reload
         | 
| 53 | 
            +
                  ip_permission_egress = @group.ip_permissions_egress.find do |permission|
         | 
| 54 | 
            +
                    permission['fromPort'] == 5000 &&
         | 
| 55 | 
            +
                      permission['toPort'] == 6000 &&
         | 
| 56 | 
            +
                      permission['ipProtocol'] == 'tcp' &&
         | 
| 57 | 
            +
                      permission['ipRanges'] == [{ 'cidrIp' => '0.0.0.0/0' }]
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
                  ip_permission_egress.nil?
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
             | 
| 38 62 | 
             
                group_forms = [
         | 
| 39 63 | 
             
                  "#{@other_group.owner_id}:#{@other_group.group_id}", # deprecated form
         | 
| 40 64 | 
             
                  @other_group.group_id,
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            Shindo.tests("AWS::Support | trusted_advisor_checks", ["aws", "support"]) do
         | 
| 2 | 
            +
              tests("collection#all").succeeds do
         | 
| 3 | 
            +
                Fog::AWS[:support].trusted_advisor_checks.all
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              @identity = Fog::AWS[:support].trusted_advisor_checks.all.first.identity
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              tests("collection#get(#{@identity})").returns(@identity) do
         | 
| 9 | 
            +
                Fog::AWS[:support].trusted_advisor_checks.get(@identity).identity
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              @model = Fog::AWS[:support].trusted_advisor_checks.all.detect { |tac| tac.id == @identity }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              tests("model#flagged_resources").returns(nil) do
         | 
| 15 | 
            +
                @model.flagged_resources
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              tests("model#flagged_resources").returns(true) do
         | 
| 19 | 
            +
                @model.flagged_resources(false).is_a?(Fog::AWS::Support::FlaggedResources)
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              tests("model#flagged_resources").returns(true) do
         | 
| 23 | 
            +
                @model.flagged_resources.first.metadata.keys.sort == @model.metadata.sort
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| @@ -0,0 +1,43 @@ | |
| 1 | 
            +
            class AWS
         | 
| 2 | 
            +
              module Support
         | 
| 3 | 
            +
                module Formats
         | 
| 4 | 
            +
                  TRUSTED_ADVISOR_CHECK_FORMAT = {
         | 
| 5 | 
            +
                    'id'          => String,
         | 
| 6 | 
            +
                    'name'        => String,
         | 
| 7 | 
            +
                    'description' => String,
         | 
| 8 | 
            +
                    'metadata'    => Array,
         | 
| 9 | 
            +
                    'category'    => String,
         | 
| 10 | 
            +
                  }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  FLAGGED_RESOURCE = {
         | 
| 13 | 
            +
                    'isSuppressed' => Fog::Boolean,
         | 
| 14 | 
            +
                    'metadata'     => Array,
         | 
| 15 | 
            +
                    'region'       => String,
         | 
| 16 | 
            +
                    'resourceId'   => String,
         | 
| 17 | 
            +
                    'status'       => String
         | 
| 18 | 
            +
                  }
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  TRUSTED_ADVISOR_CHECK_RESULT_FORMAT = {
         | 
| 21 | 
            +
                    'categorySpecificSummary' => Hash,
         | 
| 22 | 
            +
                    'checkId'                 => String,
         | 
| 23 | 
            +
                    'flaggedResources'        => [FLAGGED_RESOURCE],
         | 
| 24 | 
            +
                    'resourcesSummary'        => {
         | 
| 25 | 
            +
                      'resourcesFlagged'    => Integer,
         | 
| 26 | 
            +
                      'resourcesIgnored'    => Integer,
         | 
| 27 | 
            +
                      'resourcesProcessed'  => Integer,
         | 
| 28 | 
            +
                      'resourcesSuppressed' => Integer
         | 
| 29 | 
            +
                    },
         | 
| 30 | 
            +
                    'status'                  => String,
         | 
| 31 | 
            +
                    'timestamp'               => String
         | 
| 32 | 
            +
                  }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  DESCRIBE_TRUSTED_ADVISOR_CHECKS = {
         | 
| 35 | 
            +
                    'checks' => [TRUSTED_ADVISOR_CHECK_FORMAT]
         | 
| 36 | 
            +
                  }
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  DESCRIBE_TRUSTED_ADVISOR_CHECK_RESULT = {
         | 
| 39 | 
            +
                    'result' => TRUSTED_ADVISOR_CHECK_RESULT_FORMAT
         | 
| 40 | 
            +
                  }
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
            end
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            Shindo.tests("AWS::Support | describe_trusted_advisor_checks", ['aws', 'support']) do
         | 
| 2 | 
            +
              tests("#describe_trusted_advisor_checks").formats(AWS::Support::Formats::DESCRIBE_TRUSTED_ADVISOR_CHECKS) do
         | 
| 3 | 
            +
                Fog::AWS[:support].describe_trusted_advisor_checks.body
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              # things get weird in the mocked data depending on the order the model and requests run in
         | 
| 7 | 
            +
              if Fog.mocking?
         | 
| 8 | 
            +
                Fog::AWS[:support].reset
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              @check_id = Fog::AWS[:support].describe_trusted_advisor_checks.body['checks'].first['id']
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              tests("#describe_trusted_advisor_check_result(id: #{@check_id})").formats(AWS::Support::Formats::DESCRIBE_TRUSTED_ADVISOR_CHECK_RESULT) do
         | 
| 14 | 
            +
                Fog::AWS[:support].describe_trusted_advisor_check_result(:id => @check_id).body
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: fog-aws
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.12.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Josh Lane
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2016- | 
| 12 | 
            +
            date: 2016-09-22 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| @@ -319,6 +319,10 @@ files: | |
| 319 319 | 
             
            - lib/fog/aws/models/storage/files.rb
         | 
| 320 320 | 
             
            - lib/fog/aws/models/storage/version.rb
         | 
| 321 321 | 
             
            - lib/fog/aws/models/storage/versions.rb
         | 
| 322 | 
            +
            - lib/fog/aws/models/support/flagged_resource.rb
         | 
| 323 | 
            +
            - lib/fog/aws/models/support/flagged_resources.rb
         | 
| 324 | 
            +
            - lib/fog/aws/models/support/trusted_advisor_check.rb
         | 
| 325 | 
            +
            - lib/fog/aws/models/support/trusted_advisor_checks.rb
         | 
| 322 326 | 
             
            - lib/fog/aws/parsers/auto_scaling/basic.rb
         | 
| 323 327 | 
             
            - lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb
         | 
| 324 328 | 
             
            - lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb
         | 
| @@ -367,11 +371,19 @@ files: | |
| 367 371 | 
             
            - lib/fog/aws/parsers/cdn/post_invalidation.rb
         | 
| 368 372 | 
             
            - lib/fog/aws/parsers/cdn/streaming_distribution.rb
         | 
| 369 373 | 
             
            - lib/fog/aws/parsers/cloud_formation/basic.rb
         | 
| 374 | 
            +
            - lib/fog/aws/parsers/cloud_formation/create_change_set.rb
         | 
| 370 375 | 
             
            - lib/fog/aws/parsers/cloud_formation/create_stack.rb
         | 
| 376 | 
            +
            - lib/fog/aws/parsers/cloud_formation/describe_account_limits.rb
         | 
| 377 | 
            +
            - lib/fog/aws/parsers/cloud_formation/describe_change_set.rb
         | 
| 371 378 | 
             
            - lib/fog/aws/parsers/cloud_formation/describe_stack_events.rb
         | 
| 379 | 
            +
            - lib/fog/aws/parsers/cloud_formation/describe_stack_resource.rb
         | 
| 372 380 | 
             
            - lib/fog/aws/parsers/cloud_formation/describe_stack_resources.rb
         | 
| 373 381 | 
             
            - lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
         | 
| 382 | 
            +
            - lib/fog/aws/parsers/cloud_formation/estimate_template_cost.rb
         | 
| 383 | 
            +
            - lib/fog/aws/parsers/cloud_formation/get_stack_policy.rb
         | 
| 374 384 | 
             
            - lib/fog/aws/parsers/cloud_formation/get_template.rb
         | 
| 385 | 
            +
            - lib/fog/aws/parsers/cloud_formation/get_template_summary.rb
         | 
| 386 | 
            +
            - lib/fog/aws/parsers/cloud_formation/list_change_sets.rb
         | 
| 375 387 | 
             
            - lib/fog/aws/parsers/cloud_formation/list_stack_resources.rb
         | 
| 376 388 | 
             
            - lib/fog/aws/parsers/cloud_formation/list_stacks.rb
         | 
| 377 389 | 
             
            - lib/fog/aws/parsers/cloud_formation/update_stack.rb
         | 
| @@ -791,14 +803,28 @@ files: | |
| 791 803 | 
             
            - lib/fog/aws/requests/cdn/post_streaming_distribution.rb
         | 
| 792 804 | 
             
            - lib/fog/aws/requests/cdn/put_distribution_config.rb
         | 
| 793 805 | 
             
            - lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb
         | 
| 806 | 
            +
            - lib/fog/aws/requests/cloud_formation/cancel_update_stack.rb
         | 
| 807 | 
            +
            - lib/fog/aws/requests/cloud_formation/continue_update_rollback.rb
         | 
| 808 | 
            +
            - lib/fog/aws/requests/cloud_formation/create_change_set.rb
         | 
| 794 809 | 
             
            - lib/fog/aws/requests/cloud_formation/create_stack.rb
         | 
| 810 | 
            +
            - lib/fog/aws/requests/cloud_formation/delete_change_set.rb
         | 
| 795 811 | 
             
            - lib/fog/aws/requests/cloud_formation/delete_stack.rb
         | 
| 812 | 
            +
            - lib/fog/aws/requests/cloud_formation/describe_account_limits.rb
         | 
| 813 | 
            +
            - lib/fog/aws/requests/cloud_formation/describe_change_set.rb
         | 
| 796 814 | 
             
            - lib/fog/aws/requests/cloud_formation/describe_stack_events.rb
         | 
| 815 | 
            +
            - lib/fog/aws/requests/cloud_formation/describe_stack_resource.rb
         | 
| 797 816 | 
             
            - lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb
         | 
| 798 817 | 
             
            - lib/fog/aws/requests/cloud_formation/describe_stacks.rb
         | 
| 818 | 
            +
            - lib/fog/aws/requests/cloud_formation/estimate_template_cost.rb
         | 
| 819 | 
            +
            - lib/fog/aws/requests/cloud_formation/execute_change_set.rb
         | 
| 820 | 
            +
            - lib/fog/aws/requests/cloud_formation/get_stack_policy.rb
         | 
| 799 821 | 
             
            - lib/fog/aws/requests/cloud_formation/get_template.rb
         | 
| 822 | 
            +
            - lib/fog/aws/requests/cloud_formation/get_template_summary.rb
         | 
| 823 | 
            +
            - lib/fog/aws/requests/cloud_formation/list_change_sets.rb
         | 
| 800 824 | 
             
            - lib/fog/aws/requests/cloud_formation/list_stack_resources.rb
         | 
| 801 825 | 
             
            - lib/fog/aws/requests/cloud_formation/list_stacks.rb
         | 
| 826 | 
            +
            - lib/fog/aws/requests/cloud_formation/set_stack_policy.rb
         | 
| 827 | 
            +
            - lib/fog/aws/requests/cloud_formation/signal_resource.rb
         | 
| 802 828 | 
             
            - lib/fog/aws/requests/cloud_formation/update_stack.rb
         | 
| 803 829 | 
             
            - lib/fog/aws/requests/cloud_formation/validate_template.rb
         | 
| 804 830 | 
             
            - lib/fog/aws/requests/cloud_watch/delete_alarms.rb
         | 
| @@ -821,6 +847,7 @@ files: | |
| 821 847 | 
             
            - lib/fog/aws/requests/compute/attach_internet_gateway.rb
         | 
| 822 848 | 
             
            - lib/fog/aws/requests/compute/attach_network_interface.rb
         | 
| 823 849 | 
             
            - lib/fog/aws/requests/compute/attach_volume.rb
         | 
| 850 | 
            +
            - lib/fog/aws/requests/compute/authorize_security_group_egress.rb
         | 
| 824 851 | 
             
            - lib/fog/aws/requests/compute/authorize_security_group_ingress.rb
         | 
| 825 852 | 
             
            - lib/fog/aws/requests/compute/cancel_spot_instance_requests.rb
         | 
| 826 853 | 
             
            - lib/fog/aws/requests/compute/copy_image.rb
         | 
| @@ -918,6 +945,7 @@ files: | |
| 918 945 | 
             
            - lib/fog/aws/requests/compute/replace_route.rb
         | 
| 919 946 | 
             
            - lib/fog/aws/requests/compute/request_spot_instances.rb
         | 
| 920 947 | 
             
            - lib/fog/aws/requests/compute/reset_network_interface_attribute.rb
         | 
| 948 | 
            +
            - lib/fog/aws/requests/compute/revoke_security_group_egress.rb
         | 
| 921 949 | 
             
            - lib/fog/aws/requests/compute/revoke_security_group_ingress.rb
         | 
| 922 950 | 
             
            - lib/fog/aws/requests/compute/run_instances.rb
         | 
| 923 951 | 
             
            - lib/fog/aws/requests/compute/start_instances.rb
         | 
| @@ -1351,6 +1379,8 @@ files: | |
| 1351 1379 | 
             
            - lib/fog/aws/requests/sts/assume_role_with_web_identity.rb
         | 
| 1352 1380 | 
             
            - lib/fog/aws/requests/sts/get_federation_token.rb
         | 
| 1353 1381 | 
             
            - lib/fog/aws/requests/sts/get_session_token.rb
         | 
| 1382 | 
            +
            - lib/fog/aws/requests/support/describe_trusted_advisor_check_result.rb
         | 
| 1383 | 
            +
            - lib/fog/aws/requests/support/describe_trusted_advisor_checks.rb
         | 
| 1354 1384 | 
             
            - lib/fog/aws/ses.rb
         | 
| 1355 1385 | 
             
            - lib/fog/aws/signaturev4.rb
         | 
| 1356 1386 | 
             
            - lib/fog/aws/simpledb.rb
         | 
| @@ -1358,6 +1388,7 @@ files: | |
| 1358 1388 | 
             
            - lib/fog/aws/sqs.rb
         | 
| 1359 1389 | 
             
            - lib/fog/aws/storage.rb
         | 
| 1360 1390 | 
             
            - lib/fog/aws/sts.rb
         | 
| 1391 | 
            +
            - lib/fog/aws/support.rb
         | 
| 1361 1392 | 
             
            - lib/fog/aws/version.rb
         | 
| 1362 1393 | 
             
            - tests/credentials_tests.rb
         | 
| 1363 1394 | 
             
            - tests/helper.rb
         | 
| @@ -1463,6 +1494,7 @@ files: | |
| 1463 1494 | 
             
            - tests/models/storage/url_tests.rb
         | 
| 1464 1495 | 
             
            - tests/models/storage/version_tests.rb
         | 
| 1465 1496 | 
             
            - tests/models/storage/versions_tests.rb
         | 
| 1497 | 
            +
            - tests/models/support/trusted_advisor_tests.rb
         | 
| 1466 1498 | 
             
            - tests/parsers/elb/describe_load_balancers.rb
         | 
| 1467 1499 | 
             
            - tests/requests/auto_scaling/auto_scaling_tests.rb
         | 
| 1468 1500 | 
             
            - tests/requests/auto_scaling/describe_types_tests.rb
         | 
| @@ -1601,6 +1633,8 @@ files: | |
| 1601 1633 | 
             
            - tests/requests/sts/assume_role_with_web_identity_tests.rb
         | 
| 1602 1634 | 
             
            - tests/requests/sts/get_federation_token_tests.rb
         | 
| 1603 1635 | 
             
            - tests/requests/sts/session_token_tests.rb
         | 
| 1636 | 
            +
            - tests/requests/support/helper.rb
         | 
| 1637 | 
            +
            - tests/requests/support/trusted_advisor_check_tests.rb
         | 
| 1604 1638 | 
             
            - tests/signaturev4_tests.rb
         | 
| 1605 1639 | 
             
            - tests/signed_params_tests.rb
         | 
| 1606 1640 | 
             
            - tests/storage_tests.rb
         | 
| @@ -1629,4 +1663,3 @@ signing_key: | |
| 1629 1663 | 
             
            specification_version: 4
         | 
| 1630 1664 | 
             
            summary: Module for the 'fog' gem to support Amazon Web Services.
         | 
| 1631 1665 | 
             
            test_files: []
         | 
| 1632 | 
            -
            has_rdoc: 
         |