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(*args) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash)

    a customizable set of options



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

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.



450
451
452
# File 'lib/aws-sdk-pricing/client.rb', line 450

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.



453
454
455
# File 'lib/aws-sdk-pricing/client.rb', line 453

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: {})


428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/aws-sdk-pricing/client.rb', line 428

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.1.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:



250
251
252
253
# File '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].

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



329
330
331
332
# File '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 'lib/aws-sdk-pricing/client.rb', line 419

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.


443
444
445
# File 'lib/aws-sdk-pricing/client.rb', line 443

def waiter_names
  []
end