api

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRegion = "cn-hangzhou"
View Source
const (
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func DecodeError

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

func IsAccessDenied added in v0.2.5

func IsAccessDenied(err error) bool

func IsNotSupportedEndpoint added in v0.2.5

func IsNotSupportedEndpoint(err error) bool

func NewHTTPClient

func NewHTTPClient() *http.Client

func NewTransport

func NewTransport() *http.Transport

func NormalizeRegion

func NormalizeRegion(region string) string

Types

type APIError

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

func (*APIError) Error

func (e *APIError) Error() string

type AccountBalanceData

type AccountBalanceData struct {
	AvailableCashAmount string `json:"AvailableCashAmount"`
}

type AttachRAMPolicyToRoleResponse

type AttachRAMPolicyToRoleResponse struct {
	RequestID string `json:"RequestId"`
}

type AttachRAMPolicyToUserResponse

type AttachRAMPolicyToUserResponse struct {
	RequestID string `json:"RequestId"`
}

type Client

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

func NewClient

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

func (*Client) AttachRAMPolicyToRole

func (c *Client) AttachRAMPolicyToRole(ctx context.Context, region, roleName, policyName, policyType string) (AttachRAMPolicyToRoleResponse, error)

func (*Client) AttachRAMPolicyToUser

func (c *Client) AttachRAMPolicyToUser(ctx context.Context, region, userName, policyName, policyType string) (AttachRAMPolicyToUserResponse, error)

func (*Client) CreateRAMLoginProfile

func (c *Client) CreateRAMLoginProfile(ctx context.Context, region, userName, password string) (CreateRAMLoginProfileResponse, error)

func (*Client) CreateRAMRole

func (c *Client) CreateRAMRole(ctx context.Context, region, roleName, assumeRolePolicyDocument string) (CreateRAMRoleResponse, error)

func (*Client) CreateRAMUser

func (c *Client) CreateRAMUser(ctx context.Context, region, userName string) (CreateRAMUserResponse, error)

func (*Client) CreateRDSAccount

func (c *Client) CreateRDSAccount(ctx context.Context, region, instanceID, accountName, password string) (CreateRDSAccountResponse, error)

func (*Client) DeleteRAMRole

func (c *Client) DeleteRAMRole(ctx context.Context, region, roleName string) (DeleteRAMRoleResponse, error)

func (*Client) DeleteRAMUser

func (c *Client) DeleteRAMUser(ctx context.Context, region, userName string) (DeleteRAMUserResponse, error)

func (*Client) DeleteRDSAccount

func (c *Client) DeleteRDSAccount(ctx context.Context, region, instanceID, accountName string) (DeleteRDSAccountResponse, error)

func (*Client) DescribeDomainRecords

func (c *Client) DescribeDomainRecords(ctx context.Context, region, domainName string, pageNumber, pageSize int) (DescribeDomainRecordsResponse, error)

func (*Client) DescribeDomains

func (c *Client) DescribeDomains(ctx context.Context, region string, pageNumber, pageSize int) (DescribeDomainsResponse, error)

func (*Client) DescribeECSInstances

func (c *Client) DescribeECSInstances(ctx context.Context, region string, pageNumber, pageSize int) (DescribeECSInstancesResponse, error)

func (*Client) DescribeECSInvocationResults

func (c *Client) DescribeECSInvocationResults(ctx context.Context, region, commandID string) (DescribeECSInvocationResultsResponse, error)

func (*Client) DescribeECSRegions

func (c *Client) DescribeECSRegions(ctx context.Context, region string) (DescribeECSRegionsResponse, error)

func (*Client) DescribeRDSDatabases

func (c *Client) DescribeRDSDatabases(ctx context.Context, region, instanceID string) (DescribeRDSDatabasesResponse, error)

func (*Client) DescribeRDSInstances

func (c *Client) DescribeRDSInstances(ctx context.Context, region string, pageNumber, pageSize int) (DescribeRDSInstancesResponse, error)

func (*Client) DescribeRDSRegions

func (c *Client) DescribeRDSRegions(ctx context.Context, region string) (DescribeRDSRegionsResponse, error)

func (*Client) DescribeSASSuspEvents

func (c *Client) DescribeSASSuspEvents(ctx context.Context, region string) (DescribeSASSuspEventsResponse, error)

func (*Client) DetachRAMPolicyFromRole

func (c *Client) DetachRAMPolicyFromRole(ctx context.Context, region, roleName, policyName, policyType string) (DetachRAMPolicyFromRoleResponse, error)

func (*Client) DetachRAMPolicyFromUser

func (c *Client) DetachRAMPolicyFromUser(ctx context.Context, region, userName, policyName, policyType string) (DetachRAMPolicyFromUserResponse, error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, req Request, resp any) error

func (*Client) GetCallerIdentity

func (c *Client) GetCallerIdentity(ctx context.Context, region string) (GetCallerIdentityResponse, error)

func (*Client) GetRAMAccountAlias

func (c *Client) GetRAMAccountAlias(ctx context.Context, region string) (GetRAMAccountAliasResponse, error)

func (*Client) GetRAMLoginProfile

func (c *Client) GetRAMLoginProfile(ctx context.Context, region, userName string) (GetRAMLoginProfileResponse, error)

func (*Client) GetRAMPolicy

func (c *Client) GetRAMPolicy(ctx context.Context, region, policyName, policyType string) (GetRAMPolicyResponse, error)

func (*Client) GetRAMUser

func (c *Client) GetRAMUser(ctx context.Context, region, userName string) (GetRAMUserResponse, error)

func (*Client) GrantRDSAccountPrivilege

func (c *Client) GrantRDSAccountPrivilege(ctx context.Context, region, instanceID, accountName, dbName, privilege string) (GrantRDSAccountPrivilegeResponse, error)

func (*Client) HandleSASSecurityEvents

func (c *Client) HandleSASSecurityEvents(ctx context.Context, region, operationCode string, securityEventIDs []string) (HandleSASSecurityEventsResponse, error)

func (*Client) ListRAMPoliciesForUser

func (c *Client) ListRAMPoliciesForUser(ctx context.Context, region, userName string) (ListRAMPoliciesForUserResponse, error)

func (*Client) ListRAMUsers

func (c *Client) ListRAMUsers(ctx context.Context, region, marker string, maxItems int) (ListRAMUsersResponse, error)

func (*Client) QueryAccountBalance

func (c *Client) QueryAccountBalance(ctx context.Context, region string) (QueryAccountBalanceResponse, error)

func (*Client) QuerySMSSendStatistics

func (c *Client) QuerySMSSendStatistics(ctx context.Context, region, date string) (QuerySMSSendStatisticsResponse, error)

func (*Client) QuerySMSSignList

func (c *Client) QuerySMSSignList(ctx context.Context, region string) (QuerySMSSignListResponse, error)

func (*Client) QuerySMSTemplateList

func (c *Client) QuerySMSTemplateList(ctx context.Context, region string) (QuerySMSTemplateListResponse, error)

func (*Client) RunECSCommand

func (c *Client) RunECSCommand(ctx context.Context, region, commandType, commandContent, contentEncoding string, instanceIDs []string) (RunECSCommandResponse, error)

type CreateRAMLoginProfileResponse

type CreateRAMLoginProfileResponse struct {
	RequestID    string          `json:"RequestId"`
	LoginProfile RAMLoginProfile `json:"LoginProfile"`
}

type CreateRAMRoleResponse

type CreateRAMRoleResponse struct {
	RequestID string  `json:"RequestId"`
	Role      RAMRole `json:"Role"`
}

type CreateRAMUserResponse

type CreateRAMUserResponse struct {
	RequestID string  `json:"RequestId"`
	User      RAMUser `json:"User"`
}

type CreateRDSAccountResponse

type CreateRDSAccountResponse struct {
	RequestID string `json:"RequestId"`
}

type DeleteRAMRoleResponse

type DeleteRAMRoleResponse struct {
	RequestID string `json:"RequestId"`
}

type DeleteRAMUserResponse

type DeleteRAMUserResponse struct {
	RequestID string `json:"RequestId"`
}

type DeleteRDSAccountResponse

type DeleteRDSAccountResponse struct {
	RequestID string `json:"RequestId"`
}

type DescribeDomainRecordsResponse

type DescribeDomainRecordsResponse struct {
	TotalCount    int              `json:"TotalCount"`
	PageSize      int              `json:"PageSize"`
	RequestID     string           `json:"RequestId"`
	PageNumber    int              `json:"PageNumber"`
	DomainRecords DomainRecordList `json:"DomainRecords"`
}

type DescribeDomainsResponse

type DescribeDomainsResponse struct {
	TotalCount int        `json:"TotalCount"`
	PageSize   int        `json:"PageSize"`
	RequestID  string     `json:"RequestId"`
	PageNumber int        `json:"PageNumber"`
	Domains    DomainList `json:"Domains"`
}

type DescribeECSInstancesResponse

type DescribeECSInstancesResponse struct {
	PageSize   int             `json:"PageSize"`
	PageNumber int             `json:"PageNumber"`
	RequestID  string          `json:"RequestId"`
	TotalCount int             `json:"TotalCount"`
	Instances  ECSInstanceList `json:"Instances"`
}

type DescribeECSInvocationResultsResponse

type DescribeECSInvocationResultsResponse struct {
	RequestID  string        `json:"RequestId"`
	Invocation ECSInvocation `json:"Invocation"`
}

type DescribeECSRegionsResponse

type DescribeECSRegionsResponse struct {
	RequestID string        `json:"RequestId"`
	Regions   ECSRegionList `json:"Regions"`
}

type DescribeRDSDatabasesResponse

type DescribeRDSDatabasesResponse struct {
	RequestID string          `json:"RequestId"`
	Databases RDSDatabaseList `json:"Databases"`
}

type DescribeRDSInstancesResponse

type DescribeRDSInstancesResponse struct {
	RequestID        string          `json:"RequestId"`
	PageNumber       int             `json:"PageNumber"`
	PageRecordCount  int             `json:"PageRecordCount"`
	TotalRecordCount int             `json:"TotalRecordCount"`
	Items            RDSInstanceList `json:"Items"`
}

type DescribeRDSRegionsResponse

type DescribeRDSRegionsResponse struct {
	RequestID string        `json:"RequestId"`
	Regions   RDSRegionList `json:"Regions"`
}

type DescribeSASSuspEventsResponse

type DescribeSASSuspEventsResponse struct {
	CurrentPage int            `json:"CurrentPage"`
	PageSize    int            `json:"PageSize"`
	RequestID   string         `json:"RequestId"`
	TotalCount  int            `json:"TotalCount"`
	Count       int            `json:"Count"`
	SuspEvents  []SASSuspEvent `json:"SuspEvents"`
}

type DetachRAMPolicyFromRoleResponse

type DetachRAMPolicyFromRoleResponse struct {
	RequestID string `json:"RequestId"`
}

type DetachRAMPolicyFromUserResponse

type DetachRAMPolicyFromUserResponse struct {
	RequestID string `json:"RequestId"`
}

type DomainList

type DomainList struct {
	Domain []DomainSummary `json:"Domain"`
}

type DomainRecord

type DomainRecord struct {
	RR     string `json:"RR"`
	Type   string `json:"Type"`
	Value  string `json:"Value"`
	Status string `json:"Status"`
}

type DomainRecordList

type DomainRecordList struct {
	Record []DomainRecord `json:"Record"`
}

type DomainSummary

type DomainSummary struct {
	DomainName string `json:"DomainName"`
}

type ECSEIPAddress

type ECSEIPAddress struct {
	IPAddress string `json:"IpAddress"`
}

type ECSInstance

type ECSInstance struct {
	HostName          string               `json:"HostName"`
	InstanceID        string               `json:"InstanceId"`
	OSType            string               `json:"OSType"`
	PublicIP          ECSPublicIPList      `json:"PublicIpAddress"`
	NetworkInterfaces ECSNetworkInterfaces `json:"NetworkInterfaces"`
	EIPAddress        ECSEIPAddress        `json:"EipAddress"`
}

type ECSInstanceList

type ECSInstanceList struct {
	Instance []ECSInstance `json:"Instance"`
}

type ECSInvocation

type ECSInvocation struct {
	CommandID         string               `json:"CommandId"`
	InvokeID          string               `json:"InvokeId"`
	InvocationResults ECSInvocationResults `json:"InvocationResults"`
}

type ECSInvocationResult

type ECSInvocationResult struct {
	InvokeRecordStatus string `json:"InvokeRecordStatus"`
	Output             string `json:"Output"`
	ErrorInfo          string `json:"ErrorInfo"`
}

type ECSInvocationResults

type ECSInvocationResults struct {
	InvocationResult []ECSInvocationResult `json:"InvocationResult"`
}

type ECSNetworkInterface

type ECSNetworkInterface struct {
	PrimaryIPAddress string           `json:"PrimaryIpAddress"`
	PrivateIPSets    ECSPrivateIPSets `json:"PrivateIpSets"`
}

type ECSNetworkInterfaces

type ECSNetworkInterfaces struct {
	NetworkInterface []ECSNetworkInterface `json:"NetworkInterface"`
}

type ECSPrivateIPSet

type ECSPrivateIPSet struct {
	PrivateIPAddress string `json:"PrivateIpAddress"`
}

type ECSPrivateIPSets

type ECSPrivateIPSets struct {
	PrivateIPSet []ECSPrivateIPSet `json:"PrivateIpSet"`
}

type ECSPublicIPList

type ECSPublicIPList struct {
	IPAddress []string `json:"IpAddress"`
}

type ECSRegion

type ECSRegion struct {
	RegionID string `json:"RegionId"`
}

type ECSRegionList

type ECSRegionList struct {
	Region []ECSRegion `json:"Region"`
}

type GetCallerIdentityResponse

type GetCallerIdentityResponse struct {
	IdentityType string `json:"IdentityType"`
	AccountID    string `json:"AccountId"`
	RequestID    string `json:"RequestId"`
	PrincipalID  string `json:"PrincipalId"`
	UserID       string `json:"UserId"`
	Arn          string `json:"Arn"`
	RoleID       string `json:"RoleId"`
}

type GetRAMAccountAliasResponse

type GetRAMAccountAliasResponse struct {
	RequestID    string `json:"RequestId"`
	AccountAlias string `json:"AccountAlias"`
}

type GetRAMLoginProfileResponse

type GetRAMLoginProfileResponse struct {
	RequestID    string          `json:"RequestId"`
	LoginProfile RAMLoginProfile `json:"LoginProfile"`
}

type GetRAMPolicyResponse

type GetRAMPolicyResponse struct {
	RequestID            string                  `json:"RequestId"`
	Policy               RAMPolicy               `json:"Policy"`
	DefaultPolicyVersion RAMDefaultPolicyVersion `json:"DefaultPolicyVersion"`
}

type GetRAMUserResponse

type GetRAMUserResponse struct {
	RequestID string  `json:"RequestId"`
	User      RAMUser `json:"User"`
}

type GrantRDSAccountPrivilegeResponse

type GrantRDSAccountPrivilegeResponse struct {
	RequestID string `json:"RequestId"`
}

type HTTPStatusError

type HTTPStatusError struct {
	StatusCode int
	Status     string
	Body       string
}

func (*HTTPStatusError) Error

func (e *HTTPStatusError) Error() string

type HandleSASSecurityEventsResponse

type HandleSASSecurityEventsResponse struct {
	RequestID                    string                              `json:"RequestId"`
	HandleSecurityEventsResponse HandleSASSecurityEventsResponseItem `json:"HandleSecurityEventsResponse"`
}

type HandleSASSecurityEventsResponseItem

type HandleSASSecurityEventsResponseItem struct {
	TaskID int64 `json:"TaskId"`
}

type ListRAMPoliciesForUserResponse

type ListRAMPoliciesForUserResponse struct {
	RequestID string        `json:"RequestId"`
	Policies  RAMPolicyList `json:"Policies"`
}

type ListRAMUsersResponse

type ListRAMUsersResponse struct {
	RequestID   string      `json:"RequestId"`
	IsTruncated bool        `json:"IsTruncated"`
	Marker      string      `json:"Marker"`
	Users       RAMUserList `json:"Users"`
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(rawURL string) Option

func WithClock

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

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithNonce

func WithNonce(fn func() string) Option

func WithRetryPolicy

func WithRetryPolicy(policy RetryPolicy) Option

func WithUserAgent

func WithUserAgent(userAgent string) Option

type QueryAccountBalanceResponse

type QueryAccountBalanceResponse struct {
	Code      string             `json:"Code"`
	Message   string             `json:"Message"`
	RequestID string             `json:"RequestId"`
	Success   bool               `json:"Success"`
	Data      AccountBalanceData `json:"Data"`
}

type QuerySMSSendStatisticsResponse

type QuerySMSSendStatisticsResponse struct {
	RequestID string                `json:"RequestId"`
	Code      string                `json:"Code"`
	Message   string                `json:"Message"`
	Data      SMSSendStatisticsData `json:"Data"`
}

type QuerySMSSignListResponse

type QuerySMSSignListResponse struct {
	RequestID   string        `json:"RequestId"`
	Code        string        `json:"Code"`
	Message     string        `json:"Message"`
	TotalCount  int64         `json:"TotalCount"`
	CurrentPage int           `json:"CurrentPage"`
	PageSize    int           `json:"PageSize"`
	SmsSignList []SMSSignInfo `json:"SmsSignList"`
}

type QuerySMSTemplateListResponse

type QuerySMSTemplateListResponse struct {
	RequestID       string            `json:"RequestId"`
	Code            string            `json:"Code"`
	Message         string            `json:"Message"`
	TotalCount      int64             `json:"TotalCount"`
	CurrentPage     int               `json:"CurrentPage"`
	PageSize        int               `json:"PageSize"`
	SmsTemplateList []SMSTemplateInfo `json:"SmsTemplateList"`
}

type RAMDefaultPolicyVersion

type RAMDefaultPolicyVersion struct {
	IsDefaultVersion bool   `json:"IsDefaultVersion"`
	PolicyDocument   string `json:"PolicyDocument"`
	VersionID        string `json:"VersionId"`
	CreateDate       string `json:"CreateDate"`
}

type RAMLoginProfile

type RAMLoginProfile struct {
	MFABindRequired       bool   `json:"MFABindRequired"`
	CreateDate            string `json:"CreateDate"`
	UserName              string `json:"UserName"`
	PasswordResetRequired bool   `json:"PasswordResetRequired"`
}

type RAMPolicy

type RAMPolicy struct {
	PolicyDocument  string `json:"PolicyDocument"`
	CreateDate      string `json:"CreateDate"`
	AttachDate      string `json:"AttachDate"`
	PolicyType      string `json:"PolicyType"`
	UpdateDate      string `json:"UpdateDate"`
	AttachmentCount int    `json:"AttachmentCount"`
	DefaultVersion  string `json:"DefaultVersion"`
	PolicyName      string `json:"PolicyName"`
	Description     string `json:"Description"`
}

type RAMPolicyList

type RAMPolicyList struct {
	Policy []RAMPolicy `json:"Policy"`
}

type RAMRole

type RAMRole struct {
	CreateDate               string `json:"CreateDate"`
	RoleID                   string `json:"RoleId"`
	AttachDate               string `json:"AttachDate"`
	Arn                      string `json:"Arn"`
	UpdateDate               string `json:"UpdateDate"`
	MaxSessionDuration       int64  `json:"MaxSessionDuration"`
	Description              string `json:"Description"`
	AssumeRolePolicyDocument string `json:"AssumeRolePolicyDocument"`
	RoleName                 string `json:"RoleName"`
}

type RAMUser

type RAMUser struct {
	MobilePhone   string `json:"MobilePhone"`
	Comments      string `json:"Comments"`
	CreateDate    string `json:"CreateDate"`
	AttachDate    string `json:"AttachDate"`
	Email         string `json:"Email"`
	UserID        string `json:"UserId"`
	UpdateDate    string `json:"UpdateDate"`
	UserName      string `json:"UserName"`
	JoinDate      string `json:"JoinDate"`
	LastLoginDate string `json:"LastLoginDate"`
	DisplayName   string `json:"DisplayName"`
}

type RAMUserList

type RAMUserList struct {
	User []RAMUser `json:"User"`
}

type RDSDatabase

type RDSDatabase struct {
	DBName string `json:"DBName"`
}

type RDSDatabaseList

type RDSDatabaseList struct {
	Database []RDSDatabase `json:"Database"`
}

type RDSInstance

type RDSInstance struct {
	DBInstanceID        string `json:"DBInstanceId"`
	Engine              string `json:"Engine"`
	EngineVersion       string `json:"EngineVersion"`
	RegionID            string `json:"RegionId"`
	ConnectionString    string `json:"ConnectionString"`
	InstanceNetworkType string `json:"InstanceNetworkType"`
}

type RDSInstanceList

type RDSInstanceList struct {
	DBInstance []RDSInstance `json:"DBInstance"`
}

type RDSRegion

type RDSRegion struct {
	RegionID string `json:"RegionId"`
}

type RDSRegionList

type RDSRegionList struct {
	RDSRegion []RDSRegion `json:"RDSRegion"`
}

type RPCSigner

type RPCSigner struct{}

func (RPCSigner) Sign

func (s RPCSigner) Sign(credential auth.Credential, input SignInput) (url.Values, error)

type Request

type Request struct {
	Product      string
	Version      string
	Action       string
	Region       string
	Method       string
	Query        url.Values
	Headers      http.Header
	Idempotent   bool
	Scheme       string
	Host         string
	Path         string
	SkipRegionID bool
}

type RetryPolicy

type RetryPolicy = httpclient.RetryPolicy

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

type RunECSCommandResponse

type RunECSCommandResponse struct {
	RequestID string `json:"RequestId"`
	CommandID string `json:"CommandId"`
	InvokeID  string `json:"InvokeId"`
}

type SASEventDetail

type SASEventDetail struct {
	NameDisplay  string `json:"NameDisplay"`
	ValueDisplay string `json:"ValueDisplay"`
}

type SASSuspEvent

type SASSuspEvent struct {
	SecurityEventIDs      string           `json:"SecurityEventIds"`
	AlarmEventNameDisplay string           `json:"AlarmEventNameDisplay"`
	InstanceName          string           `json:"InstanceName"`
	EventStatus           int              `json:"EventStatus"`
	LastTime              string           `json:"LastTime"`
	Details               []SASEventDetail `json:"Details"`
}

type SMSSendStatisticsData

type SMSSendStatisticsData struct {
	TotalSize int64 `json:"TotalSize"`
}

type SMSSignInfo

type SMSSignInfo struct {
	SignName     string `json:"SignName"`
	AuditStatus  string `json:"AuditStatus"`
	BusinessType string `json:"BusinessType"`
}

type SMSTemplateInfo

type SMSTemplateInfo struct {
	TemplateName    string `json:"TemplateName"`
	AuditStatus     string `json:"AuditStatus"`
	TemplateContent string `json:"TemplateContent"`
}

type SignInput

type SignInput struct {
	Method string
	Params url.Values
}

Jump to

Keyboard shortcuts

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