Method: advice.capacityHistory

Gets the capacity history.

HTTP request

POST https://compute.googleapis.com/compute/beta/projects/{project}/regions/{region}/advice/capacityHistory

The URL uses gRPC Transcoding syntax. To know more about valid error responses that can be thrown by this HTTP request, please refer to the service error catalog

Path parameters

Parameters
project

string

Project ID for this request.

region

string

Name of the region for this request.

Request body

The request body contains data with the following structure:

JSON representation
{
  "instanceProperties": {
    "machineType": string,
    "scheduling": {
      "provisioningModel": enum
    }
  },
  "locationPolicy": {
    "location": string
  },
  "types": [
    enum
  ]
}
Fields
instanceProperties

object

Instance properties for this request.

instanceProperties.machineType

string

The machine type for the VM, such as n2-standard-4.

instanceProperties.scheduling

object

Specifies the scheduling options.

instanceProperties.scheduling.provisioningModel

enum

The provisioning model to get capacity history for. This field must be set to SPOT.

For more information, see Compute Engine instances provisioning models.

locationPolicy

object

Location policy for this request.

locationPolicy.location

string

The region or zone to get capacity history for.

It can be a partial or full URL. For example, the following are valid values:

This field is optional.

types[]

enum

List of history types to get capacity history for.

Response body

Contains the capacity history.

If successful, the response body contains data with the following structure:

JSON representation
{
  "machineType": string,
  "location": string,
  "preemptionHistory": [
    {
      "interval": {
        "startTime": string,
        "endTime": string
      },
      "preemptionRate": number
    }
  ],
  "priceHistory": [
    {
      "interval": {
        "startTime": string,
        "endTime": string
      },
      "listPrice": {
        "currencyCode": string,
        "units": string,
        "nanos": integer
      }
    }
  ]
}
Fields
machineType

string

location

string

preemptionHistory[]

object

preemptionHistory[].interval

object

preemptionHistory[].interval.startTime

string (Timestamp format)

Optional. Inclusive start of the interval.

If specified, a Timestamp matching this interval will have to be the same or after the start.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

preemptionHistory[].interval.endTime

string (Timestamp format)

Optional. Exclusive end of the interval.

If specified, a Timestamp matching this interval will have to be before the end.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

preemptionHistory[].preemptionRate

number

priceHistory[]

object

priceHistory[].interval

object

priceHistory[].interval.startTime

string (Timestamp format)

Optional. Inclusive start of the interval.

If specified, a Timestamp matching this interval will have to be the same or after the start.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

priceHistory[].interval.endTime

string (Timestamp format)

Optional. Exclusive end of the interval.

If specified, a Timestamp matching this interval will have to be before the end.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

priceHistory[].listPrice

object

priceHistory[].listPrice.currencyCode

string

The three-letter currency code defined in ISO 4217.

priceHistory[].listPrice.units

string (int64 format)

The whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.

priceHistory[].listPrice.nanos

integer

Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero. For example $-1.75 is represented as units=-1 and nanos=-750,000,000.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/compute
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

In addition to any permissions specified on the fields above, authorization requires one or more of the following IAM permissions:

  • compute.advice.capacityHistory

To find predefined roles that contain those permissions, see Compute Engine IAM Roles.