resources

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableAutoRenew

func DisableAutoRenew(c *golangsdk.ServiceClient, resourceId string) error

DisableAutoRenew is a method to disable the auto-renew of the prepaid resource.

func EnableAutoRenew

func EnableAutoRenew(c *golangsdk.ServiceClient, resourceId string) error

EnableAutoRenew is a method to enable the auto-renew of the prepaid resource.

Types

type ListOpts

type ListOpts struct {
	// List of resource IDs.
	ResourceIds []string `json:"resource_ids,omitempty"`
	// Order ID.
	OrderId string `json:"order_id,omitempty"`
	// Whether to query only the main resource, this parameter is invalid when the request parameter is the ID of the
	// sub-resource. If the resource_ids is the ID of the sub-resource, it can only query itself.
	OnlyMainResource int `json:"only_main_resource,omitempty"`
	// resource status.
	StatusList []int `json:"status_list,omitempty"`
	// Query the list of resources that have expired within the specified time period, the start time of the time
	// period, and the UTC time.
	ExpireTimeBegin string `json:"expire_time_begin,omitempty"`
	// Query the list of resources that have expired within the specified time period, the end time of the time period,
	// and the UTC time.
	ExpireTimeEnd string `json:"expire_time_end,omitempty"`
}

ListOpts allows to filter list data using given parameters.

type QueryResp

type QueryResp struct {
	// Error code.
	ErrorCode string `json:"error_code"`
	// Error message.
	ErrorMsg string `json:"error_msg"`
	// List of the prepaid resources.
	Resources []Resource `json:"data"`
	// The total number of resources queried.
	TotalCount int `json:"total_count"`
}

QueryResp is the structure that represents the API response of 'Get' method.

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) (*QueryResp, error)

type Resource

type Resource struct {
	// The internal ID of the resource to be activated. The ID generated after the resource is activated is resource_id.
	ID string `json:"id"`
	// Resource ID.
	ResourceId string `json:"resource_id"`
	// Resource name.
	ResourceName string `json:"resource_name"`
	// Cloud service area code, for example: "cn-north-1".
	Region string `json:"region_code"`
	// Cloud service type code, for example: the cloud service type code of OBS is "hws.service.type.obs".
	ServiceTypeCode string `json:"service_type_code"`
	// Resource type name, for example: the VM of ECS is "hws.resource.type.vm".
	ServieTypeName string `json:"service_type_name"`
	// Resource specifications for cloud service. If it is a resource specification of a VM, the specification will
	// contain ".win" or ".linux", such as "s2.small.1.linux".
	ResourceTypeCode string `json:"resource_type_code"`
	// Cloud service type name, for example: the name of the cloud service type of ECS is "弹性云服务器".
	ResourceTypeName string `json:"resource_type_name"`
	// Resource type name, for example: the resource type name of ECS is "云主机".
	ResourceSpecCode string `json:"resource_spec_code"`
	// Project ID.
	ProjectId string `json:"project_id"`
	// Product ID.
	ProductId string `json:"product_id"`
	// Parent resource ID.
	ParentResourceId string `json:"parent_resource_id"`
	// Whether it is the main resource.
	// + 0: non-primary resource
	// + 1: Main resource
	IsMainResource int `json:"is_main_resource"`
	// Status code.
	// + 2: in use
	// + 3: Closed (the page does not display this state)
	// + 4: Frozen
	// + 5: Expired
	Status int `json:"status"`
	// Resource effective time.
	EffectiveTime string `json:"effective_time"`
	// Resource expire time.
	ExpireTime string `json:"expire_time"`
	// Resource expire policy.
	// + 0: Expires into the grace period
	// + 1: Expired to on-demand
	// + 2: Automatic deletion after expiration (direct deletion from effective)
	// + 3: Automatic renewal after expiration
	// + 4: Freeze after expiration
	// + 5: Delete after expiration (delete from retention period)
	ExpirePolicy int `json:"expire_policy"`
}

Resource is the structure that represents the detail of the prepaid resource.

Jump to

Keyboard shortcuts

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