api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 17 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 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 Client

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

func NewClient

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

func (*Client) DoJSON

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

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 ECSServerAddress

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

type ECSServerDetail

type ECSServerDetail struct {
	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 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 ListAuthDomainsResponse

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

type ListECSServersDetailsResponse

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

type ListGroupsResponse

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

type ListProjectsResponse

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

type ListRDSInstancesResponse

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

type ListRegionsResponse

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

type ListUsersResponse

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

type ListUsersV5Response

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

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 RetryPolicy) Option

type ProjectNotFoundError

type ProjectNotFoundError struct {
	Region string
}

func (*ProjectNotFoundError) Error

func (e *ProjectNotFoundError) Error() string

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 interface {
	Do(ctx context.Context, idempotent bool, fn func() (*http.Response, error)) (*http.Response, error)
}

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

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
}

Jump to

Keyboard shortcuts

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