You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Pricing::Client

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

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



163
164
165
# File 'gems/aws-sdk-pricing/lib/aws-sdk-pricing/client.rb', line 163

def initialize(*args)
  super
end

Instance Method Details

#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:



250
251
252
253
# File 'gems/aws-sdk-pricing/lib/aws-sdk-pricing/client.rb', line 250

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.

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:



329
330
331
332
# File 'gems/aws-sdk-pricing/lib/aws-sdk-pricing/client.rb', line 329

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:



419
420
421
422
# File 'gems/aws-sdk-pricing/lib/aws-sdk-pricing/client.rb', line 419

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