Documentation
¶
Index ¶
- Constants
- func DecodeError(statusCode int, body []byte) error
- func ErrorCode(err error) int
- func NewHTTPClient() *http.Client
- func NewTransport() *http.Transport
- func NewUUIDv4() (string, error)
- func ResolveHost(service string) string
- func ResolveSigningRegion(region string) string
- type APIError
- type APIErrorBody
- type Bucket
- type Client
- type DescribeInstancesResponse
- type DescribeSubUserResponse
- type DescribeSubUsersResponse
- type Instance
- type ListBucketsResponse
- type Option
- type Request
- type RetryPolicy
- type SignInput
- type Signature
- type SubUser
Constants ¶
View Source
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" )
View Source
const DefaultSigningRegion = "jdcloud-api"
View Source
const (
DefaultTimeout = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func DecodeError ¶
func NewHTTPClient ¶
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 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 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 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 struct {
MaxAttempts int
BaseDelay time.Duration
MaxDelay time.Duration
Sleep func(context.Context, time.Duration) error
}
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy
Click to show internal directories.
Click to hide internal directories.