marketplacemetering

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package marketplacemetering provides a client for AWSMarketplace Metering.

Index

Examples

Constants

View Source
const ServiceName = "metering.marketplace"

A ServiceName is the name of the service the client will make API calls to.

Variables

This section is empty.

Functions

This section is empty.

Types

type MarketplaceMetering

type MarketplaceMetering struct {
	*client.Client
}

This reference provides descriptions of the low-level AWS Marketplace Metering Service API.

AWS Marketplace sellers can use this API to submit usage data for custom usage dimensions.

Submitting Metering Records

  • MeterUsage- Submits the metering record for a Marketplace product.

The service client's operations are safe to be used concurrently. It is not safe to mutate any of the client's properties though.

func New

New creates a new instance of the MarketplaceMetering client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

// Create a MarketplaceMetering client from just a session.
svc := marketplacemetering.New(mySession)

// Create a MarketplaceMetering client with additional configuration
svc := marketplacemetering.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*MarketplaceMetering) MeterUsage

func (c *MarketplaceMetering) MeterUsage(input *MeterUsageInput) (*MeterUsageOutput, error)

MeterUsage API operation for AWSMarketplace Metering.

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

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWSMarketplace Metering's API operation MeterUsage for usage and error information.

Returned Error Codes:

  • InternalServiceErrorException An internal error has occurred. Retry your request. If the problem persists, post a message with details on the AWS forums.

  • InvalidProductCodeException The product code passed does not match the product code used for publishing the product.

  • InvalidUsageDimensionException The usage dimension does not match one of the UsageDimensions associated with products.

  • InvalidEndpointRegionException The endpoint being called is in a region different from your EC2 instance. The region of the Metering service endpoint and the region of the EC2 instance must match.

  • TimestampOutOfBoundsException The timestamp value passed in the meterUsage() is out of allowed range.

  • DuplicateRequestException A metering record has already been emitted by the same EC2 instance for the given {usageDimension, timestamp} with a different usageQuantity.

  • ThrottlingException The calls to the MeterUsage API are throttled.

Example
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.

package main

import (
	"bytes"
	"fmt"
	"time"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/marketplacemetering"
)

var _ time.Duration
var _ bytes.Buffer

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := marketplacemetering.New(sess)

	params := &marketplacemetering.MeterUsageInput{
		DryRun:         aws.Bool(true),               // Required
		ProductCode:    aws.String("ProductCode"),    // Required
		Timestamp:      aws.Time(time.Now()),         // Required
		UsageDimension: aws.String("UsageDimension"), // Required
		UsageQuantity:  aws.Int64(1),                 // Required
	}
	resp, err := svc.MeterUsage(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*MarketplaceMetering) MeterUsageRequest

func (c *MarketplaceMetering) MeterUsageRequest(input *MeterUsageInput) (req *request.Request, output *MeterUsageOutput)

MeterUsageRequest generates a "aws/request.Request" representing the client's request for the MeterUsage operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See MeterUsage for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the MeterUsage method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the MeterUsageRequest method.
req, resp := client.MeterUsageRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

type MeterUsageInput

type MeterUsageInput struct {

	// 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.
	//
	// DryRun is a required field
	DryRun *bool `type:"boolean" required:"true"`

	// 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.
	//
	// ProductCode is a required field
	ProductCode *string `min:"1" type:"string" required:"true"`

	// Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions
	// of the timestamp will be ignored.
	//
	// Timestamp is a required field
	Timestamp *time.Time `type:"timestamp" timestampFormat:"unix" required:"true"`

	// It will be one of the 'fcp dimension name' provided during the publishing
	// of the product.
	//
	// UsageDimension is a required field
	UsageDimension *string `min:"1" type:"string" required:"true"`

	// Consumption value for the hour.
	//
	// UsageQuantity is a required field
	UsageQuantity *int64 `type:"integer" required:"true"`
	// contains filtered or unexported fields
}

func (MeterUsageInput) GoString

func (s MeterUsageInput) GoString() string

GoString returns the string representation

func (*MeterUsageInput) SetDryRun added in v1.5.0

func (s *MeterUsageInput) SetDryRun(v bool) *MeterUsageInput

SetDryRun sets the DryRun field's value.

func (*MeterUsageInput) SetProductCode added in v1.5.0

func (s *MeterUsageInput) SetProductCode(v string) *MeterUsageInput

SetProductCode sets the ProductCode field's value.

func (*MeterUsageInput) SetTimestamp added in v1.5.0

func (s *MeterUsageInput) SetTimestamp(v time.Time) *MeterUsageInput

SetTimestamp sets the Timestamp field's value.

func (*MeterUsageInput) SetUsageDimension added in v1.5.0

func (s *MeterUsageInput) SetUsageDimension(v string) *MeterUsageInput

SetUsageDimension sets the UsageDimension field's value.

func (*MeterUsageInput) SetUsageQuantity added in v1.5.0

func (s *MeterUsageInput) SetUsageQuantity(v int64) *MeterUsageInput

SetUsageQuantity sets the UsageQuantity field's value.

func (MeterUsageInput) String

func (s MeterUsageInput) String() string

String returns the string representation

func (*MeterUsageInput) Validate added in v1.1.21

func (s *MeterUsageInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type MeterUsageOutput

type MeterUsageOutput struct {
	MeteringRecordId *string `type:"string"`
	// contains filtered or unexported fields
}

func (MeterUsageOutput) GoString

func (s MeterUsageOutput) GoString() string

GoString returns the string representation

func (*MeterUsageOutput) SetMeteringRecordId added in v1.5.0

func (s *MeterUsageOutput) SetMeteringRecordId(v string) *MeterUsageOutput

SetMeteringRecordId sets the MeteringRecordId field's value.

func (MeterUsageOutput) String

func (s MeterUsageOutput) String() string

String returns the string representation

Directories

Path Synopsis
Package marketplacemeteringiface provides an interface to enable mocking the AWSMarketplace Metering service client for testing your code.
Package marketplacemeteringiface provides an interface to enable mocking the AWSMarketplace Metering service client for testing your code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL