Documentation
¶
Index ¶
- Constants
- func DecodeError(statusCode int, body []byte) error
- func ErrorCode(err error) int
- func EscapePath(path string) string
- func IsInvalidRegion(err error) bool
- func NewHTTPClient() *http.Client
- func NewLAVMDescribeImagesQuery(imageIDs string) url.Values
- func NewTransport() *http.Transport
- func NewUUIDv4() (string, error)
- func ResolveHost(service string) string
- func ResolveSigningRegion(region string) string
- type APIError
- type APIErrorBody
- type ActionTrailEvent
- type AttachSubUserPolicyRequest
- type AttachSubUserPolicyResponse
- type AttachedPolicy
- type Bucket
- type Client
- func (c *Client) CreateRDSAccount(ctx context.Context, region, instanceID string, body []byte) (CreateRDSAccountResponse, error)
- func (c *Client) DeleteRDSAccount(ctx context.Context, region, instanceID, accountName string) (DeleteRDSAccountResponse, error)
- func (c *Client) DescribeActionTrailEvents(ctx context.Context, region string, start, end int64, maxResults int, ...) (DescribeActionTrailEventsResponse, error)
- func (c *Client) DescribeDomains(ctx context.Context, region string, pageNumber, pageSize int) (DescribeDomainsResponse, error)
- func (c *Client) DescribeLogTopics(ctx context.Context, region string, pageNumber, pageSize int) (DescribeLogTopicsResponse, error)
- func (c *Client) DescribeRDSAccounts(ctx context.Context, region, instanceID string) (DescribeRDSAccountsResponse, error)
- func (c *Client) DescribeRDSInstances(ctx context.Context, region string, pageNumber, pageSize int) (DescribeRDSInstancesResponse, error)
- func (c *Client) DescribeResourceRecord(ctx context.Context, region, domainID string, pageNumber, pageSize int) (DescribeResourceRecordResponse, error)
- func (c *Client) DescribeSmsSigns(ctx context.Context, region string, pageNumber, pageSize int) (DescribeSignsResponse, error)
- func (c *Client) DescribeSmsTemplates(ctx context.Context, region string, pageNumber, pageSize int) (DescribeTemplatesResponse, error)
- func (c *Client) DoJSON(ctx context.Context, req Request, out any) error
- type CreateAccessKeyRequest
- type CreateAccessKeyResponse
- type CreateCommandRequest
- type CreateCommandResponse
- type CreateRDSAccountRequest
- type CreateRDSAccountResponse
- type CreateSubUserInfo
- type CreateSubUserRequest
- type CreateSubUserResponse
- type CreateSubUserResult
- type DeleteAccessKeyResponse
- type DeleteCommandsRequest
- type DeleteCommandsResponse
- type DeleteRDSAccountResponse
- type DeleteSubUserResponse
- type DescribeAccessKeysResponse
- type DescribeAccountAmountResponse
- type DescribeActionTrailEventsResponse
- type DescribeAttachedPoliciesResponse
- type DescribeDomainsResponse
- type DescribeInstancesResponse
- type DescribeInvocationsRequest
- type DescribeInvocationsResponse
- type DescribeLAVMImagesResponse
- type DescribeLAVMInstancesResponse
- type DescribeLogTopicsResponse
- type DescribeRDSAccountsResponse
- type DescribeRDSInstancesResponse
- type DescribeResourceRecordResponse
- type DescribeSignsResponse
- type DescribeSubUserResponse
- type DescribeSubUsersResponse
- type DescribeTemplatesResponse
- type DescribeUserPinResponse
- type DetachSubUserPolicyRequest
- type DetachSubUserPolicyResponse
- type DomainInfo
- type DomainResourceRecord
- type IAMSubUserAccessKey
- type IAMSubUserAccessKeySecret
- type Instance
- type Invocation
- type InvocationInstance
- type InvokeCommandRequest
- type InvokeCommandResponse
- type LAVMDomain
- type LAVMImage
- type LAVMInstance
- type ListBucketsResponse
- type LogTopic
- type Option
- type RDSAccount
- type RDSInstance
- type Request
- type RetryPolicy
- type SMSSign
- type SMSTemplate
- type SignInput
- type Signature
- type SubUser
Constants ¶
const ( Algorithm = "JDCLOUD2-HMAC-SHA256" SigningTerm = "jdcloud2_request" TimeFormat = "20060102T150405Z" HeaderAuthorization = "Authorization" HeaderXJdcloudDate = "X-Jdcloud-Date" HeaderXJdcloudNonce = "X-Jdcloud-Nonce" HeaderXJdcloudToken = "X-Jdcloud-Security-Token" )
const DefaultSigningRegion = "jdcloud-api"
const (
DefaultTimeout = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func DecodeError ¶
func EscapePath ¶ added in v0.2.6
EscapePath percent-encodes every byte that is not in the RFC 3986 unreserved set (A-Z / a-z / 0-9 / '-' / '.' / '_' / '~') or '/'. This matches JDCloud's official SDK (`core.EscapePath(path, false)`) so the canonical URI fed into the signer is byte-identical to what the service recomputes, including reserved characters like ':' that Go's default EscapedPath leaves alone.
func IsInvalidRegion ¶ added in v0.2.6
func NewHTTPClient ¶
func NewLAVMDescribeImagesQuery ¶ added in v0.2.6
func NewTransport ¶
func ResolveHost ¶
ResolveHost returns the service endpoint host used by J1 actions.
func ResolveSigningRegion ¶
ResolveSigningRegion returns the region that participates in signature derivation. Global IAM calls fall back to the literal "jdcloud-api".
Types ¶
type APIError ¶
type APIError struct {
HTTPStatus int
Code int
Status string
Message string
RequestID string
Service string
Action string
}
func (*APIError) IsAuthFailure ¶
type APIErrorBody ¶
type APIErrorBody struct {
Status string `json:"status"`
Code int `json:"code"`
Message string `json:"message"`
}
func (*APIErrorBody) UnmarshalJSON ¶
func (b *APIErrorBody) UnmarshalJSON(data []byte) error
type ActionTrailEvent ¶ added in v0.3.1
type ActionTrailEvent struct {
EventID string `json:"eventId"`
EventName string `json:"eventName"`
EventTime string `json:"eventTime"`
EventSource string `json:"eventSource"`
UserName string `json:"userName"`
SourceIPAddress string `json:"sourceIpAddress"`
Region string `json:"region"`
Status string `json:"status"`
AccessKey string `json:"accessKeyId"`
ResourceName string `json:"resourceName"`
ResourceType string `json:"resourceType"`
}
type AttachSubUserPolicyRequest ¶ added in v0.2.6
type AttachSubUserPolicyResponse ¶ added in v0.2.6
type AttachSubUserPolicyResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `json:"result"`
}
type AttachedPolicy ¶ added in v0.3.1
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateRDSAccount ¶ added in v0.3.1
func (*Client) DeleteRDSAccount ¶ added in v0.3.1
func (*Client) DescribeActionTrailEvents ¶ added in v0.3.1
func (c *Client) DescribeActionTrailEvents(ctx context.Context, region string, start, end int64, maxResults int, nextToken string) (DescribeActionTrailEventsResponse, error)
DescribeActionTrailEvents calls JDCloud ActionTrail to list recent audit events. The path mirrors other JDCloud regional list endpoints (`/v1/regions/<region>/<resource>:<action>` pattern).
func (*Client) DescribeDomains ¶ added in v0.3.1
func (*Client) DescribeLogTopics ¶ added in v0.3.1
func (c *Client) DescribeLogTopics(ctx context.Context, region string, pageNumber, pageSize int) (DescribeLogTopicsResponse, error)
DescribeLogTopics lists log topics in a JDCloud region.
func (*Client) DescribeRDSAccounts ¶ added in v0.3.1
func (*Client) DescribeRDSInstances ¶ added in v0.3.1
func (*Client) DescribeResourceRecord ¶ added in v0.3.1
func (c *Client) DescribeResourceRecord(ctx context.Context, region, domainID string, pageNumber, pageSize int) (DescribeResourceRecordResponse, error)
DescribeResourceRecord lists RRs under a domain. domainID is the integer ID returned by DescribeDomains, formatted as a string for the path.
func (*Client) DescribeSmsSigns ¶ added in v0.3.1
func (*Client) DescribeSmsTemplates ¶ added in v0.3.1
type CreateAccessKeyRequest ¶ added in v0.3.1
type CreateAccessKeyRequest struct {
SubUser string `json:"subUser"`
}
type CreateAccessKeyResponse ¶ added in v0.3.1
type CreateAccessKeyResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
AccessKey IAMSubUserAccessKeySecret `json:"accessKey"`
} `json:"result"`
}
type CreateCommandRequest ¶ added in v0.2.6
type CreateCommandRequest struct {
RegionID string `json:"regionId"`
CommandName string `json:"commandName"`
CommandType string `json:"commandType,omitempty"`
CommandContent string `json:"commandContent"`
Timeout int `json:"timeout,omitempty"`
Username string `json:"username,omitempty"`
Workdir string `json:"workdir,omitempty"`
CommandDescription string `json:"commandDescription,omitempty"`
EnableParameter *bool `json:"enableParameter,omitempty"`
}
type CreateCommandResponse ¶ added in v0.2.6
type CreateCommandResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
CommandID string `json:"commandId"`
} `json:"result"`
}
type CreateRDSAccountRequest ¶ added in v0.3.1
type CreateRDSAccountResponse ¶ added in v0.3.1
type CreateRDSAccountResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `json:"result"`
}
type CreateSubUserInfo ¶ added in v0.2.6
type CreateSubUserInfo struct {
Name string `json:"name"`
Password string `json:"password"`
ConsoleLogin *bool `json:"consoleLogin,omitempty"`
CreateAk *bool `json:"createAk,omitempty"`
NeedResetPassword *bool `json:"needResetPassword,omitempty"`
Description string `json:"description,omitempty"`
}
CreateSubUserInfo mirrors the SDK's CreateSubUserInfo payload. Only the fields relevant to the validation flow are serialised; the rest are omitted so JDCloud applies the documented defaults.
type CreateSubUserRequest ¶ added in v0.2.6
type CreateSubUserRequest struct {
CreateSubUserInfo CreateSubUserInfo `json:"createSubUserInfo"`
}
type CreateSubUserResponse ¶ added in v0.2.6
type CreateSubUserResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
SubUser CreateSubUserResult `json:"subUser"`
} `json:"result"`
}
type CreateSubUserResult ¶ added in v0.2.6
type DeleteAccessKeyResponse ¶ added in v0.3.1
type DeleteAccessKeyResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `json:"result"`
}
type DeleteCommandsRequest ¶ added in v0.2.6
type DeleteCommandsResponse ¶ added in v0.2.6
type DeleteCommandsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
CommandID string `json:"commandId"`
} `json:"result"`
}
type DeleteRDSAccountResponse ¶ added in v0.3.1
type DeleteRDSAccountResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `json:"result"`
}
type DeleteSubUserResponse ¶ added in v0.2.6
type DeleteSubUserResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `json:"result"`
}
type DescribeAccessKeysResponse ¶ added in v0.3.1
type DescribeAccessKeysResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
AccessKeys []IAMSubUserAccessKey `json:"accessKeys"`
} `json:"result"`
}
type DescribeAccountAmountResponse ¶ added in v0.2.6
type DescribeAccountAmountResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
TotalAmount string `json:"totalAmount"`
AvailableAmount string `json:"availableAmount"`
FrozenAmount string `json:"frozenAmount"`
EnableWithdrawAmount string `json:"enableWithdrawAmount"`
WithdrawingAmount string `json:"withdrawingAmount"`
} `json:"result"`
}
type DescribeActionTrailEventsResponse ¶ added in v0.3.1
type DescribeActionTrailEventsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Events []ActionTrailEvent `json:"events"`
NextToken string `json:"nextToken,omitempty"`
TotalCount int `json:"totalCount,omitempty"`
} `json:"result"`
}
type DescribeAttachedPoliciesResponse ¶ added in v0.3.1
type DescribeAttachedPoliciesResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Policies []AttachedPolicy `json:"policies"`
} `json:"result"`
}
DescribeAttachedPoliciesResponse maps the `GET /subUser/{subUser}:describeAttachedPolicies` action that lists managed policies bound to a sub user. The exact field names follow the JDCloud SDK convention used by sibling :attach/:detach actions.
type DescribeDomainsResponse ¶ added in v0.3.1
type DescribeDomainsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
DataList []DomainInfo `json:"dataList"`
CurrentCount int `json:"currentCount"`
TotalCount int `json:"totalCount"`
TotalPage int `json:"totalPage"`
} `json:"result"`
}
type DescribeInstancesResponse ¶
type DescribeInstancesResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Instances []Instance `json:"instances"`
TotalCount int `json:"totalCount"`
} `json:"result"`
}
type DescribeInvocationsRequest ¶ added in v0.2.6
type DescribeInvocationsResponse ¶ added in v0.2.6
type DescribeInvocationsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
TotalCount int `json:"totalCount"`
Invocations []Invocation `json:"invocations"`
} `json:"result"`
}
type DescribeLAVMImagesResponse ¶ added in v0.2.6
type DescribeLAVMImagesResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Images []LAVMImage `json:"images"`
} `json:"result"`
}
type DescribeLAVMInstancesResponse ¶ added in v0.2.6
type DescribeLAVMInstancesResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Instances []LAVMInstance `json:"instances"`
TotalCount int `json:"totalCount"`
} `json:"result"`
}
type DescribeLogTopicsResponse ¶ added in v0.3.1
type DescribeLogTopicsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Topics []LogTopic `json:"logTopics"`
TotalCount int `json:"totalCount,omitempty"`
PageNumber int `json:"pageNumber,omitempty"`
PageSize int `json:"pageSize,omitempty"`
} `json:"result"`
}
type DescribeRDSAccountsResponse ¶ added in v0.3.1
type DescribeRDSAccountsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Accounts []RDSAccount `json:"accounts"`
} `json:"result"`
}
type DescribeRDSInstancesResponse ¶ added in v0.3.1
type DescribeRDSInstancesResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
DBInstances []RDSInstance `json:"dbInstances"`
TotalCount int `json:"totalCount,omitempty"`
PageNumber int `json:"pageNumber,omitempty"`
PageSize int `json:"pageSize,omitempty"`
} `json:"result"`
}
type DescribeResourceRecordResponse ¶ added in v0.3.1
type DescribeResourceRecordResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
DataList []DomainResourceRecord `json:"dataList"`
CurrentCount int `json:"currentCount"`
TotalCount int `json:"totalCount"`
TotalPage int `json:"totalPage"`
} `json:"result"`
}
type DescribeSignsResponse ¶ added in v0.3.1
type DescribeSignsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Signs []SMSSign `json:"signs"`
TotalCount int `json:"totalCount"`
} `json:"result"`
}
type DescribeSubUserResponse ¶
type DescribeSubUserResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
SubUser SubUser `json:"subUser"`
} `json:"result"`
}
type DescribeSubUsersResponse ¶
type DescribeSubUsersResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
SubUsers []SubUser `json:"subUsers"`
Total int `json:"total"`
} `json:"result"`
}
type DescribeTemplatesResponse ¶ added in v0.3.1
type DescribeTemplatesResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Templates []SMSTemplate `json:"templates"`
TotalCount int `json:"totalCount"`
} `json:"result"`
}
type DescribeUserPinResponse ¶ added in v0.2.6
type DescribeUserPinResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Pin string `json:"pin"`
} `json:"result"`
}
DescribeUserPinResponse maps GET /regions/{regionId}/user:describeUserPin. When called with master AK/SK the returned pin is the master account's pin, which is what the JDCloud sub-account login URL expects.
type DetachSubUserPolicyRequest ¶ added in v0.2.6
type DetachSubUserPolicyResponse ¶ added in v0.2.6
type DetachSubUserPolicyResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `json:"result"`
}
type DomainInfo ¶ added in v0.3.1
type DomainInfo struct {
ID int `json:"id"`
DomainName string `json:"domainName"`
CreateTime int64 `json:"createTime"`
ExpirationDate int64 `json:"expirationDate"`
PackID int `json:"packId"`
PackName string `json:"packName"`
ResolvingStatus string `json:"resolvingStatus"`
Creator string `json:"creator"`
JcloudNs bool `json:"jcloudNs"`
LockStatus int `json:"lockStatus"`
ProbeNsList []string `json:"probeNsList,omitempty"`
DefNsList []string `json:"defNsList,omitempty"`
}
DomainInfo is the JDCloud DNS domain shape projected for cloudlist.
type DomainResourceRecord ¶ added in v0.3.1
type DomainResourceRecord struct {
ID int `json:"id"`
HostRecord string `json:"hostRecord"`
HostValue string `json:"hostValue"`
Type string `json:"type"`
TTL int `json:"ttl"`
MxPriority int `json:"mxPriority,omitempty"`
Weight int `json:"weight,omitempty"`
ViewValue []int `json:"viewValue,omitempty"`
ResolvingStatus string `json:"resolvingStatus,omitempty"`
}
DomainResourceRecord is the JDCloud DNS RR shape used by cloudlist.
type IAMSubUserAccessKey ¶ added in v0.3.1
type IAMSubUserAccessKey struct {
AccessKey string `json:"accessKey"`
Status string `json:"status,omitempty"`
CreateTime string `json:"createTime,omitempty"`
}
IAMSubUserAccessKey models the persistent fields of a JDCloud sub-user access key. The endpoint paths under /subUser/<name>:<action> follow the same convention as :attachSubUserPolicy, and the response shape is pattern-inferred — verify against the upstream SDK before relying on this in production.
type IAMSubUserAccessKeySecret ¶ added in v0.3.1
type Invocation ¶ added in v0.2.6
type Invocation struct {
Status string `json:"status"`
CommandID string `json:"commandId"`
InvokeID string `json:"invokeId"`
CommandType string `json:"commandType"`
InvocationInstances []InvocationInstance `json:"invocationInstances"`
ErrorInfo string `json:"errorInfo"`
CreateTime string `json:"createTime"`
}
Invocation mirrors the assistant's Invocation model. Only the fields used by the console validation flow are kept; the rest of the schema is omitted.
type InvocationInstance ¶ added in v0.2.6
type InvokeCommandRequest ¶ added in v0.2.6
type InvokeCommandResponse ¶ added in v0.2.6
type InvokeCommandResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
InvokeID string `json:"invokeId"`
} `json:"result"`
}
type LAVMDomain ¶ added in v0.2.6
type LAVMDomain struct {
DomainName string `json:"domainName"`
}
type LAVMInstance ¶ added in v0.2.6
type LAVMInstance struct {
InstanceID string `json:"instanceId"`
Status string `json:"status"`
PrivateIPAddress string `json:"innerIpAddress"`
PublicIPAddress string `json:"publicIpAddress"`
RegionID string `json:"regionId"`
InstanceName string `json:"instanceName"`
BusinessStatus string `json:"businessStatus"`
ImageID string `json:"imageId"`
Domains []LAVMDomain `json:"domains"`
}
type ListBucketsResponse ¶
type ListBucketsResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct {
Buckets []Bucket `json:"buckets"`
} `json:"result"`
}
type Option ¶
type Option func(*Client)
func WithBaseURL ¶
func WithHTTPClient ¶
func WithNonceFunc ¶
func WithRetryPolicy ¶
func WithRetryPolicy(policy RetryPolicy) Option
type RDSAccount ¶ added in v0.3.1
type RDSInstance ¶ added in v0.3.1
type RDSInstance struct {
InstanceID string `json:"instanceId"`
InstanceName string `json:"instanceName"`
Engine string `json:"engine"`
EngineVersion string `json:"engineVersion"`
RegionID string `json:"regionId"`
AzID []string `json:"azId,omitempty"`
InstanceStatus string `json:"instanceStatus"`
PublicDomain string `json:"publicDomainName,omitempty"`
InternalDomain string `json:"internalDomainName,omitempty"`
PublicPort int64 `json:"publicPort,omitempty"`
InternalPort int64 `json:"internalPort,omitempty"`
}
RDSInstance is the JDCloud RDS instance shape used for cloudlist `database` asset listing. Fields follow the standard describe-instances response.
type RetryPolicy ¶
type RetryPolicy = httpclient.RetryPolicy
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy