api

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BasicDateFormat     = "20060102T150405Z"
	Algorithm           = "SDK-HMAC-SHA256"
	HeaderXDate         = "X-Sdk-Date"
	HeaderHost          = "host"
	HeaderAuthorization = "Authorization"
	HeaderContentSha256 = "X-Sdk-Content-Sha256"
)
View Source
const (
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func AuthHeaderValue

func AuthHeaderValue(signature, accessKey string, signedHeaders []string) string

func DecodeError

func DecodeError(statusCode int, body []byte) error

func ErrorCode

func ErrorCode(err error) string

func IsAccessDenied added in v0.2.5

func IsAccessDenied(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsProjectNotFound

func IsProjectNotFound(err error) bool

func NewHTTPClient

func NewHTTPClient() *http.Client

func ResolveProjectID

func ResolveProjectID(ctx context.Context, client *Client, domainID, targetRegion string) (string, error)

ResolveProjectID maps a region name to its project ID via the IAM control plane. The client must be configured with a concrete control-plane region.

func Sign

func Sign(req *SignRequest) (map[string]string, error)

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	Message    string
	RequestID  string
}

func (*APIError) Error

func (e *APIError) Error() string

type AccountBalance

type AccountBalance struct {
	AccountType int32 `json:"account_type"`
	Amount      any   `json:"amount"`
}

type COCBatchExecuteCommandRequest added in v0.3.1

type COCBatchExecuteCommandRequest struct {
	InstanceIDs   []string `json:"instance_ids"`
	WorkingDir    string   `json:"working_dir,omitempty"`
	Content       string   `json:"content"`
	ScriptType    string   `json:"script_type"`
	Username      string   `json:"username,omitempty"`
	ExecutionMode string   `json:"execution_mode,omitempty"`
	TimeoutSec    int64    `json:"execute_timeout,omitempty"`
}

type COCBatchExecuteCommandResponse added in v0.3.1

type COCBatchExecuteCommandResponse struct {
	OrderID string `json:"order_id"`
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
}

type COCDescribeJobResponse added in v0.3.1

type COCDescribeJobResponse struct {
	OrderID string                 `json:"order_id"`
	JobID   string                 `json:"job_id"`
	Status  string                 `json:"status"`
	Results []COCJobInstanceResult `json:"instances"`
}

type COCJobInstanceResult added in v0.3.1

type COCJobInstanceResult struct {
	InstanceID string `json:"instance_id"`
	Status     string `json:"execute_status"`
	Output     string `json:"output"`
	Message    string `json:"message"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cred auth.Credential, opts ...Option) *Client

func (*Client) COCBatchExecuteCommand added in v0.3.1

func (c *Client) COCBatchExecuteCommand(ctx context.Context, region string, body []byte) (COCBatchExecuteCommandResponse, error)

COCBatchExecuteCommand submits a script execution against `instanceIDs`. `script` is the raw shell content; the driver wraps it in /bin/bash.

func (*Client) COCDescribeJob added in v0.3.1

func (c *Client) COCDescribeJob(ctx context.Context, region, orderID string) (COCDescribeJobResponse, error)

COCDescribeJob polls the status of a previously submitted execution.

func (*Client) DoJSON

func (c *Client) DoJSON(ctx context.Context, req Request, out any) error

type CreatePermanentAccessKeyOption added in v0.3.1

type CreatePermanentAccessKeyOption struct {
	UserID      string `json:"user_id"`
	Description string `json:"description,omitempty"`
}

type CreatePermanentAccessKeyRequest added in v0.3.1

type CreatePermanentAccessKeyRequest struct {
	Credential CreatePermanentAccessKeyOption `json:"credential"`
}

type CreatePermanentAccessKeyResponse added in v0.3.1

type CreatePermanentAccessKeyResponse struct {
	Credential IAMPermanentCredential `json:"credential"`
}

type CreateRDSDBUserRequest added in v0.3.1

type CreateRDSDBUserRequest struct {
	Name     string   `json:"name"`
	Password string   `json:"password"`
	Hosts    []string `json:"hosts,omitempty"`
	Comment  string   `json:"comment,omitempty"`
}

type CreateRDSDBUserResponse added in v0.3.1

type CreateRDSDBUserResponse struct {
	Resp string `json:"resp,omitempty"`
}

type CreateUserOption

type CreateUserOption struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	Enabled  bool   `json:"enabled"`
	DomainID string `json:"domain_id,omitempty"`
}

type CreateUserRequest

type CreateUserRequest struct {
	User CreateUserOption `json:"user"`
}

type CreateUserResponse

type CreateUserResponse struct {
	User struct {
		ID       string `json:"id"`
		DomainID string `json:"domain_id"`
	} `json:"user"`
}
type DNSLink struct {
	Self string `json:"self"`
	Next string `json:"next,omitempty"`
}

type DNSMeta added in v0.3.1

type DNSMeta struct {
	TotalCount int64 `json:"total_count"`
}

type DNSRecord added in v0.3.1

type DNSRecord struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	TTL         int64    `json:"ttl"`
	Status      string   `json:"status"`
	Description string   `json:"description"`
	ZoneID      string   `json:"zone_id"`
	Records     []string `json:"records"`
}

type DNSZone added in v0.3.1

type DNSZone struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Email       string `json:"email"`
	Description string `json:"description"`
	Status      string `json:"status"`
	ZoneType    string `json:"zone_type"`
	RecordNum   int64  `json:"record_num"`
	PoolID      string `json:"pool_id"`
	ProjectID   string `json:"project_id"`
}

DNSZone is the per-zone wire representation. `Name` is fully-qualified with a trailing dot ("example.com.") in DNS API responses; the cloudlist driver trims the dot before surfacing.

type DeleteRDSDBUserResponse added in v0.3.1

type DeleteRDSDBUserResponse struct {
	Resp string `json:"resp,omitempty"`
}

type ECSServerAddress

type ECSServerAddress struct {
	Addr         string `json:"addr"`
	OSEXTIPStype string `json:"OS-EXT-IPS:type"`
}

type ECSServerDetail

type ECSServerDetail struct {
	ID        string                        `json:"id"`
	Status    string                        `json:"status"`
	Name      string                        `json:"name"`
	Addresses map[string][]ECSServerAddress `json:"addresses"`
}

type IAMDomain

type IAMDomain struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type IAMGroup

type IAMGroup struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type IAMPermanentCredential added in v0.3.1

type IAMPermanentCredential struct {
	Access      string `json:"access"`
	Secret      string `json:"secret,omitempty"`
	UserID      string `json:"user_id"`
	CreateTime  string `json:"create_time"`
	Status      string `json:"status"`
	Description string `json:"description,omitempty"`
}

type IAMProject

type IAMProject struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	DomainID string `json:"domain_id"`
	Enabled  bool   `json:"enabled"`
}

type IAMUser

type IAMUser struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
}

type IAMUserV5

type IAMUserV5 struct {
	UserID   string `json:"user_id"`
	UserName string `json:"user_name"`
	Enabled  bool   `json:"enabled"`
}

type LTSLogGroup added in v0.3.1

type LTSLogGroup struct {
	LogGroupID         string `json:"log_group_id"`
	LogGroupName       string `json:"log_group_name"`
	CreationTime       int64  `json:"creation_time"`
	TTLInDays          int64  `json:"ttl_in_days"`
	LogStreamNameAlias string `json:"log_stream_name_alias"`
}

type ListAuthDomainsResponse

type ListAuthDomainsResponse struct {
	Domains []IAMDomain `json:"domains"`
}

type ListECSServersDetailsResponse

type ListECSServersDetailsResponse struct {
	Count   int32             `json:"count"`
	Servers []ECSServerDetail `json:"servers"`
}

type ListGroupsForUserResponse added in v0.3.1

type ListGroupsForUserResponse struct {
	Groups []IAMGroup `json:"groups"`
}

ListGroupsForUserResponse models the keystone `GET /v3/users/{user_id}/groups` payload.

type ListGroupsResponse

type ListGroupsResponse struct {
	Groups []IAMGroup `json:"groups"`
}

type ListLogGroupsResponse added in v0.3.1

type ListLogGroupsResponse struct {
	LogGroups []LTSLogGroup `json:"log_groups"`
}

type ListPermanentAccessKeysResponse added in v0.3.1

type ListPermanentAccessKeysResponse struct {
	Credentials []IAMPermanentCredential `json:"credentials"`
}

type ListProjectsResponse

type ListProjectsResponse struct {
	Projects []IAMProject `json:"projects"`
}

type ListRDSDBUsersResponse added in v0.3.1

type ListRDSDBUsersResponse struct {
	Users      []RDSDBUser `json:"users"`
	TotalCount *int32      `json:"total_count"`
}

type ListRDSInstancesResponse

type ListRDSInstancesResponse struct {
	Instances  []RDSInstance `json:"instances"`
	TotalCount *int32        `json:"total_count"`
}

type ListRecordSetsResponse added in v0.3.1

type ListRecordSetsResponse struct {
	Links      []DNSLink   `json:"links"`
	Metadata   DNSMeta     `json:"metadata"`
	RecordSets []DNSRecord `json:"recordsets"`
}

ListRecordSetsResponse is the typed shape of `GET /v2/zones/{zone_id}/recordsets`. Records is heterogeneous over record type — the wire format keeps every value as a string, with type-specific formatting (e.g. MX is "<preference> <exchange>").

type ListRegionsResponse

type ListRegionsResponse struct {
	Regions []Region `json:"regions"`
}

type ListSmsSignResponse added in v0.3.1

type ListSmsSignResponse struct {
	Signs      []MSGSMSSign `json:"signs"`
	TotalCount int          `json:"total_count"`
}

type ListSmsTemplateResponse added in v0.3.1

type ListSmsTemplateResponse struct {
	Templates  []MSGSMSTemplate `json:"templates"`
	TotalCount int              `json:"total_count"`
}

type ListTracesResponse added in v0.3.1

type ListTracesResponse struct {
	Traces   []Trace       `json:"traces"`
	MetaData TraceMetaData `json:"meta_data"`
}

type ListUsersResponse

type ListUsersResponse struct {
	Users []IAMUser `json:"users"`
}

type ListUsersV5Response

type ListUsersV5Response struct {
	Users []IAMUserV5 `json:"users"`
}

type ListZonesResponse added in v0.3.1

type ListZonesResponse struct {
	Links    []DNSLink `json:"links"`
	Metadata DNSMeta   `json:"metadata"`
	Zones    []DNSZone `json:"zones"`
}

ListZonesResponse is the typed shape of `GET /v2/zones`. Only public zones are listed at this path; private zones use a separate endpoint.

type MSGSMSSign added in v0.3.1

type MSGSMSSign struct {
	SignID     string `json:"sign_id"`
	SignName   string `json:"sign_name"`
	Status     string `json:"sign_status"`
	SignType   string `json:"sign_type"`
	CreateTime string `json:"create_time"`
	Reason     string `json:"reason"`
}

type MSGSMSTemplate added in v0.3.1

type MSGSMSTemplate struct {
	TemplateID   string `json:"template_id"`
	TemplateName string `json:"template_name"`
	Content      string `json:"content"`
	Status       string `json:"template_status"`
	TemplateType string `json:"template_type"`
	CreateTime   string `json:"create_time"`
	Reason       string `json:"reason"`
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(raw string) Option

func WithClock

func WithClock(now func() time.Time) Option

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

func WithRetryPolicy

func WithRetryPolicy(p Retryer) Option

type ProjectNotFoundError

type ProjectNotFoundError struct {
	Region string
}

func (*ProjectNotFoundError) Error

func (e *ProjectNotFoundError) Error() string

type RDSDBUser added in v0.3.1

type RDSDBUser struct {
	Name    string `json:"name"`
	Host    string `json:"host,omitempty"`
	Comment string `json:"comment,omitempty"`
	State   string `json:"state,omitempty"`
}

RDSDBUser models the RDS MySQL user resource. The control-plane endpoints share this shape across engines (MySQL, PostgreSQL); per-engine paths differ but the request/response payloads are equivalent.

type RDSDatastore

type RDSDatastore struct {
	Type    string `json:"type"`
	Version string `json:"version"`
}

type RDSInstance

type RDSInstance struct {
	ID         string        `json:"id"`
	Region     string        `json:"region"`
	Port       int32         `json:"port"`
	PublicIPs  []string      `json:"public_ips"`
	PrivateIPs []string      `json:"private_ips"`
	Datastore  *RDSDatastore `json:"datastore"`
}

type Region

type Region struct {
	ID string `json:"id"`
}

type Request

type Request struct {
	Service    string
	Region     string
	Intl       bool
	Method     string
	Path       string
	Query      url.Values
	Body       []byte
	Headers    http.Header
	Idempotent bool
}

type RetryPolicy

type RetryPolicy = httpclient.RetryPolicy

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

type Retryer added in v0.2.7

type Retryer interface {
	Do(context.Context, bool, func() (*http.Response, error)) (*http.Response, error)
}

type ShowCustomerAccountBalancesResponse

type ShowCustomerAccountBalancesResponse struct {
	AccountBalances []AccountBalance `json:"account_balances"`
}

type ShowPermanentAccessKeyResponse

type ShowPermanentAccessKeyResponse struct {
	Credential struct {
		UserID string `json:"user_id"`
	} `json:"credential"`
	ErrorMsg string `json:"error_msg"`
}

type ShowUserResponse

type ShowUserResponse struct {
	User struct {
		ID       string `json:"id"`
		Name     string `json:"name"`
		DomainID string `json:"domain_id"`
	} `json:"user"`
}

type SignRequest

type SignRequest struct {
	Method    string
	Host      string
	Path      string
	Query     url.Values
	Headers   map[string]string
	Body      []byte
	AccessKey string
	SecretKey string
	Timestamp time.Time
}

type Trace added in v0.3.1

type Trace struct {
	TraceID      string    `json:"trace_id"`
	TraceName    string    `json:"trace_name"`
	TraceRating  string    `json:"trace_rating"`
	TraceType    string    `json:"trace_type"`
	Code         string    `json:"code"`
	APIService   string    `json:"service_type"`
	OperationID  string    `json:"operation_id"`
	ResourceID   string    `json:"resource_id"`
	ResourceName string    `json:"resource_name"`
	ResourceType string    `json:"resource_type"`
	SourceIP     string    `json:"source_ip"`
	Time         int64     `json:"time"`
	User         TraceUser `json:"user"`
}

type TraceMetaData added in v0.3.1

type TraceMetaData struct {
	Count  int    `json:"count"`
	Marker string `json:"marker"`
}

type TraceUser added in v0.3.1

type TraceUser struct {
	AccessKeyID string `json:"access_key_id"`
	UserName    string `json:"user_name"`
	Name        string `json:"name"`
}

Jump to

Keyboard shortcuts

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