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

Class: Aws::MarketplaceMetering::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-marketplacemetering/lib/aws-sdk-marketplacemetering/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



152
153
154
# File 'gems/aws-sdk-marketplacemetering/lib/aws-sdk-marketplacemetering/client.rb', line 152

def initialize(*args)
  super
end

Instance Method Details

#batch_meter_usage(params = {}) ⇒ Types::BatchMeterUsageResult

BatchMeterUsage is called from a SaaS application listed on the AWS Marketplace to post metering records for a set of customers.

For identical requests, the API is idempotent; requests can be retried with the same records or a subset of the input records.

Every request to BatchMeterUsage is for one product. If you need to meter usage for multiple products, you must make multiple calls to BatchMeterUsage.

BatchMeterUsage can process up to 25 UsageRecords at a time.

Examples:

Request syntax with placeholder values


resp = client.batch_meter_usage({
  usage_records: [ # required
    {
      timestamp: Time.now, # required
      customer_identifier: "CustomerIdentifier", # required
      dimension: "UsageDimension", # required
      quantity: 1, # required
    },
  ],
  product_code: "ProductCode", # required
})

Response structure


resp.results #=> Array
resp.results[0].usage_record.timestamp #=> Time
resp.results[0].usage_record.customer_identifier #=> String
resp.results[0].usage_record.dimension #=> String
resp.results[0].usage_record.quantity #=> Integer
resp.results[0].metering_record_id #=> String
resp.results[0].status #=> String, one of "Success", "CustomerNotSubscribed", "DuplicateRecord"
resp.unprocessed_records #=> Array
resp.unprocessed_records[0].timestamp #=> Time
resp.unprocessed_records[0].customer_identifier #=> String
resp.unprocessed_records[0].dimension #=> String
resp.unprocessed_records[0].quantity #=> Integer

Parameters:

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

    ({})

Options Hash (params):

  • :usage_records (required, Array<Types::UsageRecord>)

    The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.

  • :product_code (required, String)

    Product code is used to uniquely identify a product in AWS Marketplace. The product code should be the same as the one used during the publishing of a new product.

Returns:

See Also:



217
218
219
220
# File 'gems/aws-sdk-marketplacemetering/lib/aws-sdk-marketplacemetering/client.rb', line 217

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

#meter_usage(params = {}) ⇒ Types::MeterUsageResult

API to emit metering records. For identical requests, the API is idempotent. It simply returns the metering record ID.

MeterUsage is authenticated on the buyer's AWS account, generally when running from an EC2 instance on the AWS Marketplace.

Examples:

Request syntax with placeholder values


resp = client.meter_usage({
  product_code: "ProductCode", # required
  timestamp: Time.now, # required
  usage_dimension: "UsageDimension", # required
  usage_quantity: 1, # required
  dry_run: false, # required
})

Response structure


resp.metering_record_id #=> String

Parameters:

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

    ({})

Options Hash (params):

  • :product_code (required, String)

    Product code is used to uniquely identify a product in AWS Marketplace. The product code should be the same as the one used during the publishing of a new product.

  • :timestamp (required, Time, DateTime, Date, Integer, String)

    Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions of the timestamp will be ignored.

  • :usage_dimension (required, String)

    It will be one of the fcp dimension name provided during the publishing of the product.

  • :usage_quantity (required, Integer)

    Consumption value for the hour.

  • :dry_run (required, Boolean)

    Checks whether you have the permissions required for the action, but does not make the request. If you have the permissions, the request returns DryRunOperation; otherwise, it returns UnauthorizedException.

Returns:

See Also:



271
272
273
274
# File 'gems/aws-sdk-marketplacemetering/lib/aws-sdk-marketplacemetering/client.rb', line 271

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

#resolve_customer(params = {}) ⇒ Types::ResolveCustomerResult

ResolveCustomer is called by a SaaS application during the registration process. When a buyer visits your website during the registration process, the buyer submits a registration token through their browser. The registration token is resolved through this API to obtain a CustomerIdentifier and product code.

Examples:

Request syntax with placeholder values


resp = client.resolve_customer({
  registration_token: "NonEmptyString", # required
})

Response structure


resp.customer_identifier #=> String
resp.product_code #=> String

Parameters:

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

    ({})

Options Hash (params):

  • :registration_token (required, String)

    When a buyer visits your website during the registration process, the buyer submits a registration token through the browser. The registration token is resolved to obtain a CustomerIdentifier and product code.

Returns:

See Also:



308
309
310
311
# File 'gems/aws-sdk-marketplacemetering/lib/aws-sdk-marketplacemetering/client.rb', line 308

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