instances

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	Region              string `json:"region_id" required:"true"`
	AvailabilityZone    string `json:"availability_zone" required:"true"`
	Name                string `json:"instance_name" required:"true"`
	SpecCode            string `json:"resource_spec_code" required:"true"`
	VpcID               string `json:"vpc_id" required:"true"`
	SubnetID            string `json:"net_id" required:"true"`
	SecurityGroupID     string `json:"security_group_id" required:"true"`
	EnterpriseProjectID string `json:"eps_id,omitempty"`

	// 2 - monthly; 3 - yearly
	PeriodType int `json:"period_type" required:"true"`
	// monthly: 1-9; yearly: 1-3
	PeriodNum int `json:"period_num" required:"true"`
	// 0 - false; 1 - true
	IsAutoRenew *int `json:"is_auto_renew" required:"true"`

	Tags []tags.ResourceTag `json:"tags,omitempty"`

	// the following parameters are reserved
	ProductID         string `json:"product_id,omitempty"`
	CommodityID       string `json:"commodity_id,omitempty"`
	PromotionInfo     string `json:"promotion_info,omitempty"`
	ExtPackageType    string `json:"extesion_package_type,omitempty"`
	BindingInstanceID string `json:"binding_instance_id,omitempty"`
	CdmVersion        string `json:"cdm_version,omitempty"`
	CloudServiceType  string `json:"cloud_service_type,omitempty"`
	ResourceType      string `json:"resource_type,omitempty"`
}

CreateOpts contains all the values needed to create a new instance.

func (CreateOpts) ToInstanceCreateMap

func (opts CreateOpts) ToInstanceCreateMap() (map[string]interface{}, error)

ToInstanceCreateMap builds a create request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToInstanceCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

type CreateResult struct {
	golangsdk.Result
}

CreateResult represents the result of a Create operation. Call its Extract method to get the response body.

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and uses the values to create a new instance.

func (CreateResult) Extract

func (r CreateResult) Extract() (OrderInfo, error)

Extract is a function that accepts a result and extracts the response body.

type Instance

type Instance struct {
	ID              string `json:"resource_id"`
	Name            string `json:"resource_name"`
	Type            string `json:"resource_type"`
	SpecCode        string `json:"resource_spec_code"`
	ProductID       string `json:"product_id"`
	VpcID           string `json:"vpc_id"`
	SubnetID        string `json:"net_id"`
	SecurityGroupID string `json:"security_group_id"`
	WorkspaceMode   string `json:"work_space_mode"`
	Status          int    `json:"status"`

	OrderID    string `json:"order_id"`
	OrderType  string `json:"order_type"`
	ChargeType string `json:"charge_type"`

	EffectiveTime int64  `json:"effective_time"`
	ExpireTime    int64  `json:"expire_time"`
	ExpireDays    string `json:"expire_days"`
	CreateUser    string `json:"create_user"`
	CreateTime    int64  `json:"create_time"`

	IsTrialOrder int `json:"is_trial_order"`
	IsAutoRenew  int `json:"is_auto_renew"`

	Region              string `json:"region_id"`
	AvailabilityZone    string `json:"availability_zone"`
	ProjectID           string `json:"project_id"`
	DomainID            string `json:"domain_id"`
	EnterpriseProjectID string `json:"eps_id"`
}

Instance represents a DataArts Studio instance.

func List

func List(c *golangsdk.ServiceClient, opts *ListOpts) ([]Instance, error)

List returns collection of instances.

func ListAll

func ListAll(c *golangsdk.ServiceClient, opts *ListOpts) ([]Instance, error)

ListAll returns all of instances start with initURL.

type ListOpts

type ListOpts struct {
	// Limit is the records count to be queried, the value ranges 1-100, the default value is 20
	Limit int `q:"limit"`

	// Offset number, the default value is 0
	Offset int `q:"offset"`
}

ListOpts allows the filtering collections through the API.

func (ListOpts) ToInstanceListQuery

func (opts ListOpts) ToInstanceListQuery() (string, error)

ToInstanceListQuery formats a ListOpts into a query string

type OrderInfo

type OrderInfo struct {
	ID      string `json:"resource_id"`
	OrderID string `json:"order_id"`
}

OrderInfo is the response body of a Create operation.

Jump to

Keyboard shortcuts

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