class Fog::AWS::Support::Real

Public Class Methods

new(options={}) click to toggle source
# File lib/fog/aws/support.rb, line 89
def initialize(options={})
  @connection_options = options[:connection_options] || {}
  @instrumentor       = options[:instrumentor]
  @instrumentor_name  = options[:instrumentor_name] || 'fog.aws.support'

  @region     = 'us-east-1'
  @host       = options[:host]       || "support.#{@region}.amazonaws.com"
  @path       = options[:path]       || "/"
  @port       = options[:port]       || 443
  @scheme     = options[:scheme]     || "https"
  @persistent = options[:persistent] || false
  @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
  @version    = options[:version]    || '2013-04-15'

  setup_credentials(options)
end

Public Instance Methods

_request(body, headers, idempotent, parser) click to toggle source
# File lib/fog/aws/support.rb, line 155
def _request(body, headers, idempotent, parser)
  response = @connection.request({
    :body       => body,
    :expects    => 200,
    :idempotent => idempotent,
    :headers    => headers,
    :method     => 'POST',
    :parser     => parser
  })
  response.body = Fog::JSON.decode(response.body)
  response
end
describe_trusted_advisor_check_result(options={}) click to toggle source

Describe Trusted Advisor Check Result docs.aws.amazon.com/awssupport/latest/APIReference/API_DescribeTrustedAdvisorCheckResult.html

Parameters

  • checkId <~String> - Id of the check obtained from describe_trusted_advisor_checks

  • language <~String> - Language to return. Supported values are 'en' and 'jp'

Returns

  • response<~Excon::Response>:

    • body<~Hash>

# File lib/fog/aws/requests/support/describe_trusted_advisor_check_result.rb, line 13
def describe_trusted_advisor_check_result(options={})
  request(
    'Action'   => 'DescribeTrustedAdvisorCheckResult',
    'checkId'  => options[:id],
    'language' => options[:language] || 'en'
  )
end
describe_trusted_advisor_checks(options={}) click to toggle source

Describe Trusted Advisor Checks docs.aws.amazon.com/awssupport/latest/APIReference/API_DescribeTrustedAdvisorChecks.html

Parameters

  • language <~String> - Language to return. Supported values are 'en' and 'jp'

Returns

  • response<~Excon::Response>:

    • body<~Hash>

# File lib/fog/aws/requests/support/describe_trusted_advisor_checks.rb, line 12
def describe_trusted_advisor_checks(options={})
  request(
    'Action'   => 'DescribeTrustedAdvisorChecks',
    'language' => options[:language] || 'en'
  )
end
reload() click to toggle source
# File lib/fog/aws/support.rb, line 106
def reload
  @connection.reset
end
request(params) click to toggle source
# File lib/fog/aws/support.rb, line 121
def request(params)
  refresh_credentials_if_expired
  idempotent   = params.delete(:idempotent)
  parser       = params.delete(:parser)
  action       = params.delete('Action')
  request_body = Fog::JSON.encode(params)

  body, headers = Fog::AWS.signed_params_v4(
    params,
    {
      'Content-Type' => "application/x-amz-json-1.1",
      "X-Amz-Target" => "AWSSupport_#{@version.gsub("-", "")}.#{action}"
    },
    {
      :host               => @host,
      :path               => @path,
      :port               => @port,
      :version            => @version,
      :signer             => @signer,
      :aws_session_token  => @aws_session_token,
      :method             => 'POST',
      :body               => request_body
    }
  )

  if @instrumentor
    @instrumentor.instrument("#{@instrumentor_name}.request", params) do
      _request(body, headers, idempotent, parser)
    end
  else
    _request(body, headers, idempotent, parser)
  end
end
setup_credentials(options) click to toggle source
# File lib/fog/aws/support.rb, line 110
def setup_credentials(options)
  @aws_access_key_id         = options[:aws_access_key_id]
  @aws_secret_access_key     = options[:aws_secret_access_key]
  @aws_session_token         = options[:aws_session_token]
  @aws_credentials_expire_at = options[:aws_credentials_expire_at]

  #global services that have no region are signed with the us-east-1 region
  #the only exception is GovCloud, which requires the region to be explicitly specified as us-gov-west-1
  @signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, @region, 'support')
end