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 AttachSubUserPolicyRequest
- type AttachSubUserPolicyResponse
- type Bucket
- type Client
- type CreateCommandRequest
- type CreateCommandResponse
- type CreateSubUserInfo
- type CreateSubUserRequest
- type CreateSubUserResponse
- type CreateSubUserResult
- type DeleteCommandsRequest
- type DeleteCommandsResponse
- type DeleteSubUserResponse
- type DescribeAccountAmountResponse
- type DescribeInstancesResponse
- type DescribeInvocationsRequest
- type DescribeInvocationsResponse
- type DescribeLAVMImagesResponse
- type DescribeLAVMInstancesResponse
- type DescribeSubUserResponse
- type DescribeSubUsersResponse
- type DescribeUserPinResponse
- type DetachSubUserPolicyRequest
- type DetachSubUserPolicyResponse
- type Instance
- type Invocation
- type InvocationInstance
- type InvokeCommandRequest
- type InvokeCommandResponse
- type LAVMDomain
- type LAVMImage
- type LAVMInstance
- type ListBucketsResponse
- type Option
- type Request
- type RetryPolicy
- 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 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 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 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 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 DeleteSubUserResponse ¶ added in v0.2.6
type DeleteSubUserResponse struct {
RequestID string `json:"requestId"`
Error *APIErrorBody `json:"error,omitempty"`
Result struct{} `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 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 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 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 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 RetryPolicy ¶
type RetryPolicy = httpclient.RetryPolicy
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy