Class: Aws::Pricing::Client

Inherits:
Seahorse::Client::Base
  • Object
show all
Includes:
ClientStubs
Defined in:
lib/aws-sdk-pricing/client.rb

Class Attribute Summary collapse

API Operations collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash)

Options Hash (options):

  • :credentials (required, Aws::CredentialProvider)

    Your AWS credentials. This can be an instance of any one of the following classes:

    • ‘Aws::Credentials` - Used for configuring static, non-refreshing credentials.

    • ‘Aws::InstanceProfileCredentials` - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • ‘Aws::SharedCredentials` - Used for loading credentials from a shared file, such as `~/.aws/config`.

    • ‘Aws::AssumeRoleCredentials` - Used when you need to assume a role.

    When ‘:credentials` are not configured directly, the following locations will be searched for credentials:

    • Aws.config`

    • The ‘:access_key_id`, `:secret_access_key`, and `:session_token` options.

    • ENV, ENV

    • ‘~/.aws/credentials`

    • ‘~/.aws/config`

    • EC2 IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of ‘Aws::InstanceProfileCredentails` to enable retries and extended timeouts.

  • :region (required, String)

    The AWS region to connect to. The configured ‘:region` is used to determine the service `:endpoint`. When not passed, a default `:region` is search for in the following locations:

  • :access_key_id (String)
  • :active_endpoint_cache (Boolean) — default: false

    When set to ‘true`, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to `false`.

  • :client_side_monitoring (Boolean) — default: false

    When ‘true`, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: ""

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_port (Integer) — default: 31000

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true

    When ‘true`, an attempt is made to coerce request parameters into the required types.

  • :disable_host_prefix_injection (Boolean) — default: false

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available.

  • :endpoint (String)

    The client endpoint is normally constructed from the ‘:region` option. You should only configure an `:endpoint` when connecting to test endpoints. This should be avalid HTTP(S) URI.

  • :endpoint_cache_max_entries (Integer) — default: 1000

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec.

  • :endpoint_discovery (Boolean) — default: false

    When set to ‘true`, endpoint discovery will be enabled for operations when available. Defaults to `false`.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default

    The log formatter.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the ‘:logger` at.

  • :logger (Logger)

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :profile (String) — default: "default"

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, ‘default’ is used.

  • :retry_base_delay (Float) — default: 0.3

    The base delay in seconds used by the default backoff function.

  • :retry_jitter (Symbol) — default: :none

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.

    @see www.awsarchitectureblog.com/2015/03/backoff.html

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials.

  • :retry_max_delay (Integer) — default: 0

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.

  • :secret_access_key (String)
  • :session_token (String)
  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When ‘:simple_json` is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    ** Please note ** When response stubbing is enabled, no HTTP requests are made, and retries are disabled.

  • :validate_params (Boolean) — default: true

    When ‘true`, request parameters are validated before sending the request.



212
213
214
# File 'lib/aws-sdk-pricing/client.rb', line 212

def initialize(*args)
  super
end

Class Attribute Details

.identifierObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



499
500
501
# File 'lib/aws-sdk-pricing/client.rb', line 499

def identifier
  @identifier
end

Class Method Details

.errors_moduleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



502
503
504
# File 'lib/aws-sdk-pricing/client.rb', line 502

def errors_module
  Errors
end

Instance Method Details

#build_request(operation_name, params = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • params ({}) (defaults to: {})


477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/aws-sdk-pricing/client.rb', line 477

def build_request(operation_name, params = {})
  handlers = @handlers.for(operation_name)
  context = Seahorse::Client::RequestContext.new(
    operation_name: operation_name,
    operation: config.api.operation(operation_name),
    client: self,
    params: params,
    config: config)
  context[:gem_name] = 'aws-sdk-pricing'
  context[:gem_version] = '1.6.0'
  Seahorse::Client::Request.new(handlers, context)
end

#describe_services(params = {}) ⇒ Types::DescribeServicesResponse

Returns the metadata for one service or a list of the metadata for all services. Use this without a service code to get the service codes for all services. Use it with a service code, such as ‘AmazonEC2`, to get information specific to that service, such as the attribute names available for that service. For example, some of the attribute names available for EC2 are `volumeType`, `maxIopsVolume`, `operation`, `locationType`, and `instanceCapacity10xlarge`.

Examples:

Example: To retrieve a list of services and service codes


resp = client.describe_services({
  format_version: "aws_v1", 
  max_results: 1, 
  service_code: "AmazonEC2", 
})

resp.to_h outputs the following:
{
  format_version: "aws_v1", 
  next_token: "abcdefg123", 
  services: [
    {
      attribute_names: [
        "volumeType", 
        "maxIopsvolume", 
        "instanceCapacity10xlarge", 
        "locationType", 
        "operation", 
      ], 
      service_code: "AmazonEC2", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_services({
  service_code: "String",
  format_version: "String",
  next_token: "String",
  max_results: 1,
})

Response structure


resp.services #=> Array
resp.services[0].service_code #=> String
resp.services[0].attribute_names #=> Array
resp.services[0].attribute_names[0] #=> String
resp.format_version #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :service_code (String)

    The code for the service whose information you want to retrieve, such as ‘AmazonEC2`. You can use the `ServiceCode` to filter the results in a `GetProducts` call. To retrieve a list of all services, leave this blank.

  • :format_version (String)

    The format version that you want the response to be in.

    Valid values are: ‘aws_v1`

  • :next_token (String)

    The pagination token that indicates the next set of results that you want to retrieve.

  • :max_results (Integer)

    The maximum number of results that you want returned in the response.

Returns:

See Also:



299
300
301
302
# File 'lib/aws-sdk-pricing/client.rb', line 299

def describe_services(params = {}, options = {})
  req = build_request(:describe_services, params)
  req.send_request(options)
end

#get_attribute_values(params = {}) ⇒ Types::GetAttributeValuesResponse

Returns a list of attribute values. Attibutes are similar to the details in a Price List API offer file. For a list of available attributes, see [Offer File Definitions] in the [AWS Billing and Cost Management User Guide].

[1]: docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/reading-an-offer.html#pps-defs [2]: docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-what-is.html

Examples:

Example: To retrieve a list of attribute values


# This operation returns a list of values available for the given attribute.

resp = client.get_attribute_values({
  attribute_name: "volumeType", 
  max_results: 2, 
  service_code: "AmazonEC2", 
})

resp.to_h outputs the following:
{
  attribute_values: [
    {
      value: "Throughput Optimized HDD", 
    }, 
    {
      value: "Provisioned IOPS", 
    }, 
  ], 
  next_token: "GpgauEXAMPLEezucl5LV0w==:7GzYJ0nw0DBTJ2J66EoTIIynE6O1uXwQtTRqioJzQadBnDVgHPzI1en4BUQnPCLpzeBk9RQQAWaFieA4+DapFAGLgk+Z/9/cTw9GldnPOHN98+FdmJP7wKU3QQpQ8MQr5KOeBkIsAqvAQYdL0DkL7tHwPtE5iCEByAmg9gcC/yBU1vAOsf7R3VaNN4M5jMDv3woSWqASSIlBVB6tgW78YL22KhssoItM/jWW+aP6Jqtq4mldxp/ct6DWAl+xLFwHU/CbketimPPXyqHF3/UXDw==", 
}

Request syntax with placeholder values


resp = client.get_attribute_values({
  service_code: "String", # required
  attribute_name: "String", # required
  next_token: "String",
  max_results: 1,
})

Response structure


resp.attribute_values #=> Array
resp.attribute_values[0] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :service_code (required, String)

    The service code for the service whose attributes you want to retrieve. For example, if you want the retrieve an EC2 attribute, use ‘AmazonEC2`.

  • :attribute_name (required, String)

    The name of the attribute that you want to retrieve the values for, such as ‘volumeType`.

  • :next_token (String)

    The pagination token that indicates the next set of results that you want to retrieve.

  • :max_results (Integer)

    The maximum number of results to return in response.

Returns:

See Also:



378
379
380
381
# File 'lib/aws-sdk-pricing/client.rb', line 378

def get_attribute_values(params = {}, options = {})
  req = build_request(:get_attribute_values, params)
  req.send_request(options)
end

#get_products(params = {}) ⇒ Types::GetProductsResponse

Returns a list of all products that match the filter criteria.

Examples:

Example: To retrieve a list of products


# This operation returns a list of products that match the given criteria.

resp = client.get_products({
  filters: [
    {
      field: "ServiceCode", 
      type: "TERM_MATCH", 
      value: "AmazonEC2", 
    }, 
    {
      field: "volumeType", 
      type: "TERM_MATCH", 
      value: "Provisioned IOPS", 
    }, 
  ], 
  format_version: "aws_v1", 
  max_results: 1, 
})

resp.to_h outputs the following:
{
  format_version: "aws_v1", 
  next_token: "57r3EXAMPLEujbzWfHF7Ciw==:ywSmZsD3mtpQmQLQ5XfOsIMkYybSj+vAT+kGmwMFq+K9DGmIoJkz7lunVeamiOPgthdWSO2a7YKojCO+zY4dJmuNl2QvbNhXs+AJ2Ufn7xGmJncNI2TsEuAsVCUfTAvAQNcwwamtk6XuZ4YdNnooV62FjkV3ZAn40d9+wAxV7+FImvhUHi/+f8afgZdGh2zPUlH8jlV9uUtj0oHp8+DhPUuHXh+WBII1E/aoKpPSm3c=", 
  price_list: [
    "{\"product\":{\"productFamily\":\"Storage\",\"attributes\":{\"storageMedia\":\"SSD-backed\",\"maxThroughputvolume\":\"320 MB/sec\",\"volumeType\":\"Provisioned IOPS\",\"maxIopsvolume\":\"20000\",\"servicecode\":\"AmazonEC2\",\"usagetype\":\"CAN1-EBS:VolumeUsage.piops\",\"locationType\":\"AWS Region\",\"location\":\"Canada (Central)\",\"servicename\":\"Amazon Elastic Compute Cloud\",\"maxVolumeSize\":\"16 TiB\",\"operation\":\"\"},\"sku\":\"WQGC34PB2AWS8R4U\"},\"serviceCode\":\"AmazonEC2\",\"terms\":{\"OnDemand\":{\"WQGC34PB2AWS8R4U.JRTCKXETXF\":{\"priceDimensions\":{\"WQGC34PB2AWS8R4U.JRTCKXETXF.6YS6EN2CT7\":{\"unit\":\"GB-Mo\",\"endRange\":\"Inf\",\"description\":\"$0.138 per GB-month of Provisioned IOPS SSD (io1)  provisioned storage - Canada (Central)\",\"appliesTo\":[],\"rateCode\":\"WQGC34PB2AWS8R4U.JRTCKXETXF.6YS6EN2CT7\",\"beginRange\":\"0\",\"pricePerUnit\":{\"USD\":\"0.1380000000\"}}},\"sku\":\"WQGC34PB2AWS8R4U\",\"effectiveDate\":\"2017-08-01T00:00:00Z\",\"offerTermCode\":\"JRTCKXETXF\",\"termAttributes\":{}}}},\"version\":\"20170901182201\",\"publicationDate\":\"2017-09-01T18:22:01Z\"}", 
  ], 
}

Request syntax with placeholder values


resp = client.get_products({
  service_code: "String",
  filters: [
    {
      type: "TERM_MATCH", # required, accepts TERM_MATCH
      field: "String", # required
      value: "String", # required
    },
  ],
  format_version: "String",
  next_token: "String",
  max_results: 1,
})

Response structure


resp.format_version #=> String
resp.price_list #=> Array
resp.price_list[0] #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :service_code (String)

    The code for the service whose products you want to retrieve.

  • :filters (Array<Types::Filter>)

    The list of filters that limit the returned products. only products that match all filters are returned.

  • :format_version (String)

    The format version that you want the response to be in.

    Valid values are: ‘aws_v1`

  • :next_token (String)

    The pagination token that indicates the next set of results that you want to retrieve.

  • :max_results (Integer)

    The maximum number of results to return in the response.

Returns:

See Also:



468
469
470
471
# File 'lib/aws-sdk-pricing/client.rb', line 468

def get_products(params = {}, options = {})
  req = build_request(:get_products, params)
  req.send_request(options)
end

#waiter_namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deprecated.


492
493
494
# File 'lib/aws-sdk-pricing/client.rb', line 492

def waiter_names
  []
end