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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, serviceId, instanceId, token string) error

Delete is a method to remove an existing instance using its related microservice ID, instance ID (and token).

Types

type CreateOpts

type CreateOpts struct {
	// Host information.
	HostName string `json:"hostName" required:"true"`
	// Access address information.
	Endpoints []string `json:"endpoints" required:"true"`
	// Microservice version.
	Version string `json:"version,omitempty"`
	// Instance status. Value: UP, DOWN, STARTING, or OUTOFSERVICE. Default value: UP.
	Status string `json:"status,omitempty"`
	// Extended attribute. You can customize a key and value. The value must be at least 1 byte long.
	Properties map[string]interface{} `json:"properties,omitempty"`
	// Health check information.
	HealthCheck *HealthCheck `json:"healthCheck,omitempty"`
	// Data center information.
	DataCenterInfo *DataCenter `json:"dataCenterInfo,omitempty"`
}

CreateOpts is the structure required by the Create method to create a new dedicated microservice instance.

type CreateResp

type CreateResp struct {
	// Microservice instance ID.
	ID string `json:"instanceId"`
}

CreateResp is the structure that represents the response of the API request.

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOpts, serviceId, token string) (*CreateResp, error)

Create is a method to create a dedicated microservice instance using given parameters.

type DataCenter

type DataCenter struct {
	// Region name.
	Name string `json:"name" required:"true"`
	// Region.
	Region string `json:"region" required:"true"`
	// AZ.
	AvailableZone string `json:"availableZone" required:"true"`
}

DataCenter is an object that specifies the configuration of the instance data center.

type ErrorResponse

type ErrorResponse struct {
	// Error detail.
	Detail string `json:"detail"`
	// Error code.
	ErrCode string `json:"errorCode"`
	// Error message.
	ErrMessage string `json:"errorMessage"`
}

ErrorResponse is the structure that represents the details of the request error.

type HealthCheck

type HealthCheck struct {
	// Heartbeat mode. Value: push or pull.
	Mode string `json:"mode" required:"true"`
	// Heartbeat interval. Unit: s. If the value is less than 5s, the registration is performed at an interval of 5s.
	Interval int `json:"interval" required:"true"`
	// Maximum retries.
	Times int `json:"times" required:"true"`
	// Port.
	Port int `json:"port,omitempty"`
}

HealthCheck is an object that specifies the configuration of the instance health check.

type Instance

type Instance struct {
	// Host information.
	HostName string `json:"hostName"`
	// Access address information.
	Endpoints []string `json:"endpoints"`
	// Instance ID, which must be unique. The instance ID is generated by the service center.
	ID string `json:"instanceId"`
	// Microservice ID, which must be unique.
	// During instance creation, use the service ID in the URL instead of the service ID here.
	ServiceId string `json:"serviceId"`
	// Microservice version.
	Version string `json:"version"`
	// Instance status. Value: UP, DOWN, STARTING, or OUTOFSERVICE. Default value: UP.
	Status string `json:"status"`
	// Extended attribute. You can customize a key and value. The value must be at least 1 byte long.
	Properties map[string]interface{} `json:"properties"`
	// Health check information.
	HealthCheck HealthCheck `json:"healthCheck"`
	// Data center information.
	DataCenterInfo DataCenter `json:"dataCenterInfo"`
	// Time when an instance is created, which is automatically generated.
	Timestamp string `json:"timestamp"`
	// Update time.
	ModTimestamp string `json:"modTimestamp"`
}

Instance is the structure that represents the details of the Microservice service instance.

func Get

func Get(c *golangsdk.ServiceClient, serviceId, instanceId, token string) (*Instance, error)

Get is a method to retrieves a particular configuration based on its unique ID (and token).

func List

func List(c *golangsdk.ServiceClient, serviceId string, token string) ([]Instance, error)

List is a method to retrieves all instance informations under specified microservice using its related microservice ID (and token).

Jump to

Keyboard shortcuts

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