Updated on 2024-06-19 GMT+08:00

Querying Flavor Sales Policies

Function

This API is used to query the flavor sales policies of spot pricing ECSs and IES instances.

Constraints

This API is used only to query the sales policies of spot ECS flavors.

URI

GET /v1/{project_id}/cloudservers/flavor-sell-policies?flavor_id={flavor_id}

Table 1 describes the parameters in the URI.
Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Data Type

Description

flavor_id

No

String

Specifies the flavor ID of the ECS.

For details about the specifications that have been brought online, see ECS Types.

NOTE:

This field supports fuzzy search (prefix match) and exact search.

sell_status

No

String

Specifies the sales status of the ECS system flavor.

Options:

  • available: indicates that the flavor is available.
  • sellout: indicates that the flavor has been sold out.

sell_mode

No

String

Specifies the billing mode.

Options:

  • postPaid: indicates the pay-per-use billing mode, which is not supported currently.
  • prePaid: indicates the yearly/monthly billing mode, which is not supported currently.
  • spot: indicates the spot pricing billing mode.
  • ri: indicates the reserved instance, which is not supported currently.

availability_zone_id

No

String

Specifies the AZ.

You need to obtain the AZ by referring to Regions and Endpoints.

longest_spot_duration_hours_gt

No

Integer

Queries the policy of a spot ECS whose predefined duration is greater than the configured value.

largest_spot_duration_count_gt

No

Integer

Queries the policy of a spot ECS with the number of durations greater than the configured value.

longest_spot_duration_hours

No

Integer

Queries the policy of a spot ECS whose predefined duration is equal to the configured value.

largest_spot_duration_count

No

Integer

Queries the policy of a spot ECS with the number of durations equal to the configured value.

interruption_policy

No

String

Specifies the interruption policy.

Options:

  • immediate: Resources are released immediately.
  • delay: The release of resources is delayed.

limit

No

Integer

Specifies the maximum number of policies that can be displayed per page. The default value is 1,000.

marker

No

String

Specifies the ID of the last flavor on each page as the paging marker.

Request

None

Response

Table 3 describes the response parameters.
Table 3 Response parameters

Parameter

Type

Description

count

Integer

Specifies the number of ECS flavor sales policies.

sell_policies

Array of objects

For details about ECS flavor sales policies, see Table 4.

Table 4 sell_policies field description

Parameter

Type

Description

id

Integer

Specifies the ID of ECS flavor.

flavor_id

String

Specifies the ECS flavor ID.

sell_status

String

Specifies the sales status of the ECS flavor.

  • sellout: indicates that the flavor has been sold out.
  • available: indicates that the flavor is available.

availability_zone_id

String

Specifies the AZ of the ECS flavor.

sell_mode

String

Specifies the billing mode of the ECS flavor.

  • postPaid: indicates the pay-per-use billing mode.
  • prePaid: indicates the yearly/monthly billing mode.
  • spot: indicates the spot pricing billing mode.
  • ri: indicates the reserved instance.

spot_options

object

Specifies the sales policy details of the spot ECS flavor. For details, see Table 5.

Table 5 spot_options field description

Parameter

Type

Description

longest_spot_duration_hours

Integer

Specifies the predefined duration of the spot ECS.

largest_spot_duration_count

Integer

Specifies the number of durations.

interruption_policy

String

Specifies the interruption policy of the spot ECS.

  • immediate: Resources are released immediately.
  • delay: The release of resources is delayed.

Example Request

Query the sales policy list of ECS flavor s3.small.1.

GET https://{endpoint}/v1/{project_id}/cloudservers/flavor-sell-policies?flavor_id=s3.small.1

Example Response

{
    "count":2,
    "sell_policies":[
        {
            "id":1,
            "flavor_id":"s3.small.1",
            "sell_status":"available",
            "availability_zone_id":"az1",
            "sell_mode":"spot",
            "spot_options":{
                "longest_spot_duration_hours":6,
                "largest_spot_duration_count":1,
                "interruption_policy":"immediate"
            }
        },
        {
            "id":2,
            "flavor_id":"s3.small.1",
            "sell_status":"available",
            "availability_zone_id":"az1",
            "sell_mode":"spot",
            "spot_options":{
                "longest_spot_duration_hours":6,
                "largest_spot_duration_count":1,
                "interruption_policy":"immediate"
            }
        }
    ]
}


Error Codes

See Error Codes.