reserved instanceIBM Cloud

Get the usage details - go

Get the usage details.

(mqcloud *MqcloudV1) GetUsageDetails(getUsageDetailsOptions *GetUsageDetailsOptions) (result *Usage, response *core.DetailedResponse, err error)
(mqcloud *MqcloudV1) GetUsageDetailsWithContext(ctx context.Context, getUsageDetailsOptions *GetUsageDetailsOptions) (result *Usage, response *core.DetailedResponse, err error)

Request

Instantiate the GetUsageDetailsOptions struct and set the fields to provide parameter values for the GetUsageDetails method.

Parameter WithContext method only
ctx
Context
A context.Context instance that you can use to specify a timeout for the operation or to cancel an in-flight request.
GetUsageDetailsOptions The GetUsageDetails options
ServiceInstanceGuid
Required
*string

The GUID that uniquely identifies the IBM® MQ as a Service instance.

Possible values: length = 36, Value must match regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/

Request example

getUsageDetailsOptions := mqcloudService.NewGetUsageDetailsOptions(
  "a2b4d4bc-dadb-4637-bcec-9b7d1e723af8",
)

usage, response, err := mqcloudService.GetUsageDetails(getUsageDetailsOptions)
if err != nil {
  panic(err)
}
b, _ := json.MarshalIndent(usage, "", "  ")
fmt.Println(string(b))

Response

Usage Usage details
VpcEntitlement
float32
VPC entitlement.
VpcUsage
float32
VPC usage.
Status code  
200 Usage details for an account
301 URI has permanently Moved
400 Bad Request
401 Unauthorized
404 Resource not found
429 Service Is Overused
500 Internal Server Error

Response example

Success example

{
  "vpc_entitlement": 4,
  "vpc_usage": 3.5
}