Documentation ¶
Overview ¶
Package usagemeteringv4 : Operations and models for the UsageMeteringV4 service
Index ¶
- Constants
- func GetServiceURLForRegion(region string) (string, error)
- func UnmarshalMeasureAndQuantity(m map[string]json.RawMessage, result interface{}) (err error)
- func UnmarshalResourceInstanceUsage(m map[string]json.RawMessage, result interface{}) (err error)
- func UnmarshalResourceUsageDetails(m map[string]json.RawMessage, result interface{}) (err error)
- func UnmarshalResponseAccepted(m map[string]json.RawMessage, result interface{}) (err error)
- type MeasureAndQuantity
- type ReportResourceUsageOptions
- func (options *ReportResourceUsageOptions) SetHeaders(param map[string]string) *ReportResourceUsageOptions
- func (options *ReportResourceUsageOptions) SetResourceID(resourceID string) *ReportResourceUsageOptions
- func (options *ReportResourceUsageOptions) SetResourceUsage(resourceUsage []ResourceInstanceUsage) *ReportResourceUsageOptions
- type ResourceInstanceUsage
- type ResourceUsageDetails
- type ResponseAccepted
- type UsageMeteringV4
- func (usageMetering *UsageMeteringV4) Clone() *UsageMeteringV4
- func (usageMetering *UsageMeteringV4) DisableRetries()
- func (usageMetering *UsageMeteringV4) EnableRetries(maxRetries int, maxRetryInterval time.Duration)
- func (usageMetering *UsageMeteringV4) GetEnableGzipCompression() bool
- func (usageMetering *UsageMeteringV4) GetServiceURL() string
- func (*UsageMeteringV4) NewMeasureAndQuantity(measure string, quantity interface{}) (model *MeasureAndQuantity, err error)
- func (*UsageMeteringV4) NewReportResourceUsageOptions(resourceID string, resourceUsage []ResourceInstanceUsage) *ReportResourceUsageOptions
- func (*UsageMeteringV4) NewResourceInstanceUsage(resourceInstanceID string, planID string, start int64, end int64, ...) (model *ResourceInstanceUsage, err error)
- func (usageMetering *UsageMeteringV4) ReportResourceUsage(reportResourceUsageOptions *ReportResourceUsageOptions) (result *ResponseAccepted, response *core.DetailedResponse, err error)
- func (usageMetering *UsageMeteringV4) ReportResourceUsageWithContext(ctx context.Context, reportResourceUsageOptions *ReportResourceUsageOptions) (result *ResponseAccepted, response *core.DetailedResponse, err error)
- func (usageMetering *UsageMeteringV4) SetDefaultHeaders(headers http.Header)
- func (usageMetering *UsageMeteringV4) SetEnableGzipCompression(enableGzip bool)
- func (usageMetering *UsageMeteringV4) SetServiceURL(url string) error
- type UsageMeteringV4Options
Constants ¶
const DefaultServiceName = "usage_metering"
DefaultServiceName is the default key used to find external configuration information.
const DefaultServiceURL = "https://billing.cloud.ibm.com"
DefaultServiceURL is the default URL to make service requests to.
Variables ¶
This section is empty.
Functions ¶
func GetServiceURLForRegion ¶
GetServiceURLForRegion returns the service URL to be used for the specified region
func UnmarshalMeasureAndQuantity ¶
func UnmarshalMeasureAndQuantity(m map[string]json.RawMessage, result interface{}) (err error)
UnmarshalMeasureAndQuantity unmarshals an instance of MeasureAndQuantity from the specified map of raw messages.
func UnmarshalResourceInstanceUsage ¶
func UnmarshalResourceInstanceUsage(m map[string]json.RawMessage, result interface{}) (err error)
UnmarshalResourceInstanceUsage unmarshals an instance of ResourceInstanceUsage from the specified map of raw messages.
func UnmarshalResourceUsageDetails ¶
func UnmarshalResourceUsageDetails(m map[string]json.RawMessage, result interface{}) (err error)
UnmarshalResourceUsageDetails unmarshals an instance of ResourceUsageDetails from the specified map of raw messages.
func UnmarshalResponseAccepted ¶
func UnmarshalResponseAccepted(m map[string]json.RawMessage, result interface{}) (err error)
UnmarshalResponseAccepted unmarshals an instance of ResponseAccepted from the specified map of raw messages.
Types ¶
type MeasureAndQuantity ¶
type MeasureAndQuantity struct { // The name of the measure. Measure *string `json:"measure" validate:"required"` // For consumption-based submissions, `quantity` can be a double or integer value. For event-based submissions that do // not have binary states, previous and current values are required, such as `{ "previous": 1, "current": 2 }`. Quantity interface{} `json:"quantity" validate:"required"` }
MeasureAndQuantity : A usage measurement.
type ReportResourceUsageOptions ¶
type ReportResourceUsageOptions struct { // The resource for which the usage is submitted. ResourceID *string `json:"resource_id" validate:"required,ne="` // Array of usage records. ResourceUsage []ResourceInstanceUsage `json:"resource_usage" validate:"required"` // Allows users to set headers on API requests Headers map[string]string }
ReportResourceUsageOptions : The ReportResourceUsage options.
func (*ReportResourceUsageOptions) SetHeaders ¶
func (options *ReportResourceUsageOptions) SetHeaders(param map[string]string) *ReportResourceUsageOptions
SetHeaders : Allow user to set Headers
func (*ReportResourceUsageOptions) SetResourceID ¶
func (options *ReportResourceUsageOptions) SetResourceID(resourceID string) *ReportResourceUsageOptions
SetResourceID : Allow user to set ResourceID
func (*ReportResourceUsageOptions) SetResourceUsage ¶
func (options *ReportResourceUsageOptions) SetResourceUsage(resourceUsage []ResourceInstanceUsage) *ReportResourceUsageOptions
SetResourceUsage : Allow user to set ResourceUsage
type ResourceInstanceUsage ¶
type ResourceInstanceUsage struct { // The ID of the instance that incurred the usage. The ID is a CRN for instances that are provisioned with the resource // controller. ResourceInstanceID *string `json:"resource_instance_id" validate:"required"` // The plan with which the instance's usage should be metered. PlanID *string `json:"plan_id" validate:"required"` // The pricing region to which the usage must be aggregated. This field is required if the ID is not a CRN or if the // CRN does not have a region. Region *string `json:"region,omitempty"` // The time from which the resource instance was metered in the format milliseconds since epoch. Start *int64 `json:"start" validate:"required"` // The time until which the resource instance was metered in the format milliseconds since epoch. This value is the // same as start value for event-based submissions. End *int64 `json:"end" validate:"required"` // Usage measurements for the resource instance. MeasuredUsage []MeasureAndQuantity `json:"measured_usage" validate:"required"` // If an instance's usage should be aggregated at the consumer level, specify the ID of the consumer. Usage is // accumulated to the instance-consumer combination. ConsumerID *string `json:"consumer_id,omitempty"` }
ResourceInstanceUsage : Usage information for a resource instance.
type ResourceUsageDetails ¶
type ResourceUsageDetails struct { // A response code similar to HTTP status codes. Status *int64 `json:"status" validate:"required"` // The location of the usage. Location *string `json:"location" validate:"required"` // The error code that was encountered. Code *string `json:"code,omitempty"` // A description of the error. Message *string `json:"message,omitempty"` }
ResourceUsageDetails : Resource usage details.
type ResponseAccepted ¶
type ResponseAccepted struct { // Response body that contains the status of each submitted usage record. Resources []ResourceUsageDetails `json:"resources" validate:"required"` }
ResponseAccepted : Response when usage submitted is accepted.
type UsageMeteringV4 ¶
type UsageMeteringV4 struct {
Service *core.BaseService
}
UsageMeteringV4 : IBM Cloud Usage Metering is a platform service that enables service providers to submit metrics collected for resource instances provisioned by IBM Cloud users. IBM and third-party service providers that are delivering an integrated billing service in IBM Cloud are required to submit usage for all active service instances every hour. This is important because inability to report usage can lead to loss of revenue collection for IBM, in turn causing loss of revenue share for the service providers.
Version: 4.0.8
func NewUsageMeteringV4 ¶
func NewUsageMeteringV4(options *UsageMeteringV4Options) (service *UsageMeteringV4, err error)
NewUsageMeteringV4 : constructs an instance of UsageMeteringV4 with passed in options.
func NewUsageMeteringV4UsingExternalConfig ¶
func NewUsageMeteringV4UsingExternalConfig(options *UsageMeteringV4Options) (usageMetering *UsageMeteringV4, err error)
NewUsageMeteringV4UsingExternalConfig : constructs an instance of UsageMeteringV4 with passed in options and external configuration.
func (*UsageMeteringV4) Clone ¶
func (usageMetering *UsageMeteringV4) Clone() *UsageMeteringV4
Clone makes a copy of "usageMetering" suitable for processing requests.
func (*UsageMeteringV4) DisableRetries ¶
func (usageMetering *UsageMeteringV4) DisableRetries()
DisableRetries disables automatic retries for requests invoked for this service instance.
func (*UsageMeteringV4) EnableRetries ¶
func (usageMetering *UsageMeteringV4) EnableRetries(maxRetries int, maxRetryInterval time.Duration)
EnableRetries enables automatic retries for requests invoked for this service instance. If either parameter is specified as 0, then a default value is used instead.
func (*UsageMeteringV4) GetEnableGzipCompression ¶
func (usageMetering *UsageMeteringV4) GetEnableGzipCompression() bool
GetEnableGzipCompression returns the service's EnableGzipCompression field
func (*UsageMeteringV4) GetServiceURL ¶
func (usageMetering *UsageMeteringV4) GetServiceURL() string
GetServiceURL returns the service URL
func (*UsageMeteringV4) NewMeasureAndQuantity ¶
func (*UsageMeteringV4) NewMeasureAndQuantity(measure string, quantity interface{}) (model *MeasureAndQuantity, err error)
NewMeasureAndQuantity : Instantiate MeasureAndQuantity (Generic Model Constructor)
func (*UsageMeteringV4) NewReportResourceUsageOptions ¶
func (*UsageMeteringV4) NewReportResourceUsageOptions(resourceID string, resourceUsage []ResourceInstanceUsage) *ReportResourceUsageOptions
NewReportResourceUsageOptions : Instantiate ReportResourceUsageOptions
func (*UsageMeteringV4) NewResourceInstanceUsage ¶
func (*UsageMeteringV4) NewResourceInstanceUsage(resourceInstanceID string, planID string, start int64, end int64, measuredUsage []MeasureAndQuantity) (model *ResourceInstanceUsage, err error)
NewResourceInstanceUsage : Instantiate ResourceInstanceUsage (Generic Model Constructor)
func (*UsageMeteringV4) ReportResourceUsage ¶
func (usageMetering *UsageMeteringV4) ReportResourceUsage(reportResourceUsageOptions *ReportResourceUsageOptions) (result *ResponseAccepted, response *core.DetailedResponse, err error)
ReportResourceUsage : Report Resource Controller resource usage Report usage for resource instances that were provisioned through the resource controller.
func (*UsageMeteringV4) ReportResourceUsageWithContext ¶
func (usageMetering *UsageMeteringV4) ReportResourceUsageWithContext(ctx context.Context, reportResourceUsageOptions *ReportResourceUsageOptions) (result *ResponseAccepted, response *core.DetailedResponse, err error)
ReportResourceUsageWithContext is an alternate form of the ReportResourceUsage method which supports a Context parameter
func (*UsageMeteringV4) SetDefaultHeaders ¶
func (usageMetering *UsageMeteringV4) SetDefaultHeaders(headers http.Header)
SetDefaultHeaders sets HTTP headers to be sent in every request
func (*UsageMeteringV4) SetEnableGzipCompression ¶
func (usageMetering *UsageMeteringV4) SetEnableGzipCompression(enableGzip bool)
SetEnableGzipCompression sets the service's EnableGzipCompression field
func (*UsageMeteringV4) SetServiceURL ¶
func (usageMetering *UsageMeteringV4) SetServiceURL(url string) error
SetServiceURL sets the service URL
type UsageMeteringV4Options ¶
type UsageMeteringV4Options struct { ServiceName string URL string Authenticator core.Authenticator }
UsageMeteringV4Options : Service options