Documentation
¶
Overview ¶
Package request is the request of service
Index ¶
- func Bool(val bool) *bool
- func BoolValue(ptr *bool) bool
- func EncodeForm(req Common) (map[string]string, error)
- func EncodeJSON(req Common) (map[string]interface{}, error)
- func Float64(val float64) *float64
- func Float64Value(ptr *float64) float64
- func Int(val int) *int
- func IntValue(ptr *int) int
- func String(val string) *string
- func StringValue(ptr *string) string
- func TimeDuration(val time.Duration) *time.Duration
- func TimeDurationValue(ptr *time.Duration) time.Duration
- func ToBase64Query(s *string) *string
- func ToQueryMap(req Common) (map[string]string, error)deprecated
- type BaseGenericRequest
- func (r *BaseGenericRequest) GetAction() string
- func (r BaseGenericRequest) GetPayload() map[string]interface{}
- func (r *BaseGenericRequest) GetProjectId() string
- func (r *BaseGenericRequest) GetRegion() string
- func (r *BaseGenericRequest) GetZone() string
- func (r *BaseGenericRequest) SetPayload(m map[string]interface{}) error
- type Common
- type CommonBase
- func (c *CommonBase) GetAction() string
- func (c *CommonBase) GetActionRef() *string
- func (c *CommonBase) GetEncoder() Encoder
- func (c *CommonBase) GetMaxretries() int
- func (c *CommonBase) GetProjectId() string
- func (c *CommonBase) GetProjectIdRef() *string
- func (c *CommonBase) GetRegion() string
- func (c *CommonBase) GetRegionRef() *string
- func (c *CommonBase) GetRequestTime() time.Time
- func (c *CommonBase) GetRetryCount() int
- func (c *CommonBase) GetRetryable() bool
- func (c *CommonBase) GetTimeout() time.Duration
- func (c *CommonBase) GetZone() string
- func (c *CommonBase) GetZoneRef() *string
- func (c *CommonBase) SetAction(val string) error
- func (c *CommonBase) SetActionRef(val *string) error
- func (c *CommonBase) SetEncoder(encoder Encoder)
- func (c *CommonBase) SetProjectId(val string) error
- func (c *CommonBase) SetProjectIdRef(val *string) error
- func (c *CommonBase) SetRegion(val string) error
- func (c *CommonBase) SetRegionRef(val *string) error
- func (c *CommonBase) SetRequestTime(requestTime time.Time)
- func (c *CommonBase) SetRetryCount(retryCount int)
- func (c *CommonBase) SetRetryable(retryable bool)
- func (c *CommonBase) SetZone(val string) error
- func (c *CommonBase) SetZoneRef(val *string) error
- func (c *CommonBase) WithRetry(maxRetries int)
- func (c *CommonBase) WithTimeout(timeout time.Duration)
- type Encoder
- type FormEncoder
- type GenericRequest
- type JSONEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeJSON ¶ added in v0.20.0
func Float64Value ¶ added in v0.9.0
Float64Value will return a float64 from float64 pointer
func StringValue ¶ added in v0.9.0
StringValue will return a string from string pointer
func TimeDuration ¶ added in v0.9.0
TimeDuration will return a pointer to time.Duration
func TimeDurationValue ¶ added in v0.9.0
TimeDurationValue will return a time.Duration from a time.Duration pointer
func ToBase64Query ¶ added in v0.9.0
ToBase64Query will encode a wrapped string as base64 wrapped string
func ToQueryMap
deprecated
Types ¶
type BaseGenericRequest ¶ added in v0.14.0
type BaseGenericRequest struct {
CommonBase
// contains filtered or unexported fields
}
func (*BaseGenericRequest) GetAction ¶ added in v0.14.0
func (r *BaseGenericRequest) GetAction() string
func (BaseGenericRequest) GetPayload ¶ added in v0.14.0
func (r BaseGenericRequest) GetPayload() map[string]interface{}
func (*BaseGenericRequest) GetProjectId ¶ added in v0.14.0
func (r *BaseGenericRequest) GetProjectId() string
func (*BaseGenericRequest) GetRegion ¶ added in v0.14.0
func (r *BaseGenericRequest) GetRegion() string
func (*BaseGenericRequest) GetZone ¶ added in v0.14.0
func (r *BaseGenericRequest) GetZone() string
func (*BaseGenericRequest) SetPayload ¶ added in v0.14.0
func (r *BaseGenericRequest) SetPayload(m map[string]interface{}) error
type Common ¶
type Common interface {
GetAction() string
SetAction(string) error
GetActionRef() *string
SetActionRef(*string) error
GetRegion() string
SetRegion(string) error
GetRegionRef() *string
SetRegionRef(*string) error
GetProjectId() string
SetProjectId(string) error
GetProjectIdRef() *string
SetProjectIdRef(*string) error
GetZone() string
SetZone(string) error
GetZoneRef() *string
SetZoneRef(*string) error
SetRetryCount(int)
GetRetryCount() int
WithRetry(int)
GetMaxretries() int
WithTimeout(time.Duration)
GetTimeout() time.Duration
SetRequestTime(time.Time)
GetRequestTime() time.Time
SetRetryable(retryable bool)
GetRetryable() bool
SetEncoder(encoder Encoder)
GetEncoder() Encoder
}
Common is the common request
type CommonBase ¶
type CommonBase struct {
Action *string
Region *string
Zone *string
ProjectId *string
// contains filtered or unexported fields
}
CommonBase is the base struct of common request
func (*CommonBase) GetAction ¶
func (c *CommonBase) GetAction() string
GetAction will return action of request
func (*CommonBase) GetActionRef ¶ added in v0.6.8
func (c *CommonBase) GetActionRef() *string
GetActionRef will return a pointer to action of request
func (*CommonBase) GetEncoder ¶ added in v0.20.0
func (c *CommonBase) GetEncoder() Encoder
GetProjectId will get project id of request
func (*CommonBase) GetMaxretries ¶
func (c *CommonBase) GetMaxretries() int
GetMaxretries will return max retry count of request
func (*CommonBase) GetProjectId ¶
func (c *CommonBase) GetProjectId() string
GetProjectId will get project id of request
func (*CommonBase) GetProjectIdRef ¶ added in v0.6.8
func (c *CommonBase) GetProjectIdRef() *string
GetProjectIdRef will get a pointer to project id of request
func (*CommonBase) GetRegion ¶
func (c *CommonBase) GetRegion() string
GetRegion will return region of request
func (*CommonBase) GetRegionRef ¶ added in v0.6.8
func (c *CommonBase) GetRegionRef() *string
GetRegionRef will return a pointer to region of request
func (*CommonBase) GetRequestTime ¶
func (c *CommonBase) GetRequestTime() time.Time
GetRequestTime will get timeout of request
func (*CommonBase) GetRetryCount ¶
func (c *CommonBase) GetRetryCount() int
GetRetryCount will return retry count of request
func (*CommonBase) GetRetryable ¶
func (c *CommonBase) GetRetryable() bool
GetRetryable will return if the request is retryable
func (*CommonBase) GetTimeout ¶
func (c *CommonBase) GetTimeout() time.Duration
GetTimeout will get timeout of request
func (*CommonBase) GetZone ¶ added in v0.6.3
func (c *CommonBase) GetZone() string
GetZone will return zone of request
func (*CommonBase) GetZoneRef ¶ added in v0.6.8
func (c *CommonBase) GetZoneRef() *string
GetZoneRef will return a pointer to zone of request
func (*CommonBase) SetAction ¶
func (c *CommonBase) SetAction(val string) error
SetAction will set action of request
func (*CommonBase) SetActionRef ¶ added in v0.6.8
func (c *CommonBase) SetActionRef(val *string) error
SetActionRef will set a pointer to action of request
func (*CommonBase) SetEncoder ¶ added in v0.20.0
func (c *CommonBase) SetEncoder(encoder Encoder)
SetProjectId will set project id of request
func (*CommonBase) SetProjectId ¶
func (c *CommonBase) SetProjectId(val string) error
SetProjectId will set project id of request
func (*CommonBase) SetProjectIdRef ¶ added in v0.6.8
func (c *CommonBase) SetProjectIdRef(val *string) error
SetProjectIdRef will set a pointer to project id of request
func (*CommonBase) SetRegion ¶
func (c *CommonBase) SetRegion(val string) error
SetRegion will set region of request
func (*CommonBase) SetRegionRef ¶ added in v0.6.8
func (c *CommonBase) SetRegionRef(val *string) error
SetRegionRef will set a pointer to region of request
func (*CommonBase) SetRequestTime ¶
func (c *CommonBase) SetRequestTime(requestTime time.Time)
SetRequestTime will set timeout of request
func (*CommonBase) SetRetryCount ¶
func (c *CommonBase) SetRetryCount(retryCount int)
SetRetryCount will set retry count of request
func (*CommonBase) SetRetryable ¶
func (c *CommonBase) SetRetryable(retryable bool)
SetRetryable will set if the request is retryable
func (*CommonBase) SetZone ¶ added in v0.6.3
func (c *CommonBase) SetZone(val string) error
SetZone will set zone of request
func (*CommonBase) SetZoneRef ¶ added in v0.6.8
func (c *CommonBase) SetZoneRef(val *string) error
SetZoneRef will set a pointer to zone of request
func (*CommonBase) WithRetry ¶
func (c *CommonBase) WithRetry(maxRetries int)
WithRetry will set max retry count of request
func (*CommonBase) WithTimeout ¶
func (c *CommonBase) WithTimeout(timeout time.Duration)
WithTimeout will set timeout of request
type Encoder ¶ added in v0.20.0
type Encoder interface {
Encode(req Common) (*http.HttpRequest, error)
}
func NewFormEncoder ¶ added in v0.20.0
func NewFormEncoder(cfg *config.Config, cred *auth.Credential) Encoder
func NewJSONEncoder ¶ added in v0.20.0
func NewJSONEncoder(cfg *config.Config, cred *auth.Credential) Encoder
type FormEncoder ¶ added in v0.20.0
type FormEncoder struct {
// contains filtered or unexported fields
}
func (*FormEncoder) Encode ¶ added in v0.20.0
func (e *FormEncoder) Encode(req Common) (*http.HttpRequest, error)
Encode will return a map for url form encoded
type GenericRequest ¶ added in v0.14.0
type JSONEncoder ¶ added in v0.20.0
type JSONEncoder struct {
// contains filtered or unexported fields
}
func (*JSONEncoder) Encode ¶ added in v0.20.0
func (e *JSONEncoder) Encode(req Common) (*http.HttpRequest, error)
Encode will encode request struct instance as a map for json encoded