Documentation ¶
Index ¶
- Constants
- Variables
- func IsAuthError(err error) bool
- func IsBadResponse(err error, f func(b *BadResponse) bool) bool
- func IsErrMsg(err error, msg string) bool
- func IsErrType(err error, name string) bool
- func IsErrorCode(err error, code string) (bool, string)
- func IsErrorCodeAttribute(err error, code string, attribute string) bool
- func IsGatewayTimeout(err error) bool
- func IsInvalidSchema(err error) bool
- func IsNotFound(err error) bool
- func IsParameterError(err error) bool
- func IsRequestFormatError(err error) bool
- func IsStatusCode(err error, code int) bool
- func IsSystemError(err error) bool
- func IsTooManyRequests(err error) bool
- func MarshalApply(body interface{}) ([]byte, error)
- func MarshalCreate(body interface{}) ([]byte, error)
- func MarshalOutput(spec Spec) ([]byte, error)
- func MarshalUpdate(body interface{}) ([]byte, error)
- func UnMarshalInput(bs []byte, obj Object) error
- func UnmarshalRead(bs []byte, o interface{}) error
- type Action
- type AsyncResponse
- type BadResponse
- func (r *BadResponse) Error() string
- func (r *BadResponse) IsAuthError() bool
- func (r *BadResponse) IsErrMsg(msg string) bool
- func (r *BadResponse) IsErrType(name string) bool
- func (r *BadResponse) IsErrorCode(code string) (bool, string)
- func (r *BadResponse) IsErrorCodeAttribute(code string, attribute string) bool
- func (r *BadResponse) IsGatewayTimeout() bool
- func (r *BadResponse) IsInvalidSchema() bool
- func (r *BadResponse) IsNotFound() bool
- func (r *BadResponse) IsParameterError() bool
- func (r *BadResponse) IsRequestFormatError() bool
- func (r *BadResponse) IsStatusCode(code int) bool
- func (r *BadResponse) IsSystemError() bool
- func (r *BadResponse) IsTooManyRequests() bool
- type Client
- func (c *Client) Apply(ctx context.Context, s Spec, body interface{}) (string, error)
- func (c *Client) Cancel(ctx context.Context, s Spec) (string, error)
- func (c *Client) Count(ctx context.Context, s CountableListSpec, keywords SearchParams) (string, error)
- func (c *Client) Create(ctx context.Context, s Spec, body interface{}) (string, error)
- func (c *Client) Delete(ctx context.Context, s Spec) (string, error)
- func (c *Client) Do(ctx context.Context, spec Spec, action Action, body interface{}, ...) (string, error)
- func (c *Client) List(ctx context.Context, s ListSpec, keywords SearchParams) (string, error)
- func (c *Client) ListAll(ctx context.Context, s CountableListSpec, keywords SearchParams) (string, error)
- func (c *Client) Read(ctx context.Context, s Spec) (string, error)
- func (c *Client) SetRoundTripper(rt http.RoundTripper)
- func (c *Client) Update(ctx context.Context, s Spec, body interface{}) (string, error)
- func (c *Client) WatchList(ctx context.Context, interval time.Duration, s ListSpec, keyword SearchParams) error
- func (c *Client) WatchListAll(ctx context.Context, interval time.Duration, s CountableListSpec, ...) error
- func (c *Client) WatchRead(ctx context.Context, interval time.Duration, s Spec) error
- type ClientInterface
- type CommonSearchParams
- func (k *CommonSearchParams) GetLimit() int32
- func (k *CommonSearchParams) GetOffset() int32
- func (k *CommonSearchParams) GetType() SearchType
- func (s *CommonSearchParams) GetValues() (url.Values, error)
- func (k *CommonSearchParams) SetLimit(limit int32)
- func (k *CommonSearchParams) SetOffset(offset int32)
- func (k *CommonSearchParams) SetType(t SearchType)
- type Count
- type CountableListSpec
- type ErrorDetail
- type ErrorDetails
- type Initializer
- type JSONAPIAdapter
- func (j *JSONAPIAdapter) MarshalApply(body interface{}) ([]byte, error)
- func (j *JSONAPIAdapter) MarshalCreate(body interface{}) ([]byte, error)
- func (j *JSONAPIAdapter) MarshalOutput(spec Spec) ([]byte, error)
- func (j *JSONAPIAdapter) MarshalUpdate(body interface{}) ([]byte, error)
- func (j *JSONAPIAdapter) UnMarshalInput(bs []byte, obj Object) error
- func (j *JSONAPIAdapter) UnmarshalRead(bs []byte, o interface{}) error
- type JSONAPIInterface
- type JSONFileInterface
- type KeywordsBoolean
- type KeywordsFavorite
- type KeywordsID
- type KeywordsLabels
- type KeywordsState
- type KeywordsString
- type Label
- type ListSpec
- type Logger
- type Object
- type OutputFrame
- type RateRoundTripper
- type RawResponse
- type RequestInfo
- type ResponseCommon
- type ResponseInfo
- type RowSearchParams
- type SearchDate
- type SearchLimit
- type SearchOffset
- type SearchOrder
- type SearchParams
- type SearchType
- type Spec
- type StdLogger
Constants ¶
View Source
const ( ErrorTypeParamaterError string = "ParameterError" ErrorTypeNotFound string = "NotFound" ErrorTypeTooManyRequests string = "TooManyRequests" ErrorTypeSystemError string = "SystemError" ErrorTypeGatewayTimeout string = "GatewayTimeout" )
View Source
const DefaultEndpoint = "https://api.dns-platform.jp/dpf/v1"
Variables ¶
View Source
var JSON = NewJSONAPIAdapter()
Functions ¶
func IsAuthError ¶
func IsBadResponse ¶ added in v0.3.0
func IsBadResponse(err error, f func(b *BadResponse) bool) bool
func IsErrorCodeAttribute ¶
func IsGatewayTimeout ¶ added in v0.3.0
func IsInvalidSchema ¶
func IsNotFound ¶
func IsParameterError ¶ added in v0.3.0
func IsRequestFormatError ¶ added in v0.3.0
func IsStatusCode ¶ added in v0.3.0
func IsSystemError ¶ added in v0.3.0
func IsTooManyRequests ¶ added in v0.3.0
func MarshalApply ¶
func MarshalCreate ¶
func MarshalOutput ¶
func MarshalUpdate ¶
func UnMarshalInput ¶
func UnmarshalRead ¶
Types ¶
type AsyncResponse ¶
type AsyncResponse struct { ResponseCommon `read:",inline"` JobsURL string `read:"jobs_url"` }
type BadResponse ¶
type BadResponse struct { ResponseCommon `read:",inline"` StatusCode int `read:"-"` ErrorType string `read:"error_type"` ErrorMessage string `read:"error_message"` ErrorDetails ErrorDetails `read:"error_details"` }
func (*BadResponse) Error ¶
func (r *BadResponse) Error() string
func (*BadResponse) IsAuthError ¶ added in v0.3.0
func (r *BadResponse) IsAuthError() bool
func (*BadResponse) IsErrMsg ¶ added in v0.3.0
func (r *BadResponse) IsErrMsg(msg string) bool
func (*BadResponse) IsErrType ¶ added in v0.3.0
func (r *BadResponse) IsErrType(name string) bool
func (*BadResponse) IsErrorCode ¶ added in v0.3.0
func (r *BadResponse) IsErrorCode(code string) (bool, string)
func (*BadResponse) IsErrorCodeAttribute ¶ added in v0.3.0
func (r *BadResponse) IsErrorCodeAttribute(code string, attribute string) bool
func (*BadResponse) IsGatewayTimeout ¶ added in v0.3.0
func (r *BadResponse) IsGatewayTimeout() bool
func (*BadResponse) IsInvalidSchema ¶ added in v0.3.0
func (r *BadResponse) IsInvalidSchema() bool
func (*BadResponse) IsNotFound ¶ added in v0.3.0
func (r *BadResponse) IsNotFound() bool
func (*BadResponse) IsParameterError ¶ added in v0.3.0
func (r *BadResponse) IsParameterError() bool
func (*BadResponse) IsRequestFormatError ¶ added in v0.3.0
func (r *BadResponse) IsRequestFormatError() bool
func (*BadResponse) IsStatusCode ¶ added in v0.3.0
func (r *BadResponse) IsStatusCode(code int) bool
func (*BadResponse) IsSystemError ¶ added in v0.3.0
func (r *BadResponse) IsSystemError() bool
func (*BadResponse) IsTooManyRequests ¶ added in v0.3.0
func (r *BadResponse) IsTooManyRequests() bool
type Client ¶
type Client struct { Endpoint string Token string LastRequest *RequestInfo LastResponse *ResponseInfo // contains filtered or unexported fields }
func (*Client) Count ¶
func (c *Client) Count(ctx context.Context, s CountableListSpec, keywords SearchParams) (string, error)
func (*Client) ListAll ¶ added in v0.5.0
func (c *Client) ListAll(ctx context.Context, s CountableListSpec, keywords SearchParams) (string, error)
func (*Client) SetRoundTripper ¶ added in v0.9.0
func (c *Client) SetRoundTripper(rt http.RoundTripper)
func (*Client) WatchList ¶
func (c *Client) WatchList(ctx context.Context, interval time.Duration, s ListSpec, keyword SearchParams) error
ctx should set Deadline or Timeout interval must be grater than equals to 1s s is ListAble Spec.
func (*Client) WatchListAll ¶
func (c *Client) WatchListAll(ctx context.Context, interval time.Duration, s CountableListSpec, keyword SearchParams) error
ctx should set Deadline or Timeout interval must be grater than equals to 1s s is CountableListSpec Spec.
type ClientInterface ¶ added in v0.3.0
type ClientInterface interface { SetRoundTripper(rt http.RoundTripper) Read(ctx context.Context, s Spec) (string, error) List(ctx context.Context, s ListSpec, keywords SearchParams) (string, error) ListAll(ctx context.Context, s CountableListSpec, keywords SearchParams) (string, error) Count(ctx context.Context, s CountableListSpec, keywords SearchParams) (string, error) Update(ctx context.Context, s Spec, body interface{}) (string, error) Create(ctx context.Context, s Spec, body interface{}) (string, error) Apply(ctx context.Context, s Spec, body interface{}) (string, error) Delete(ctx context.Context, s Spec) (string, error) Cancel(ctx context.Context, s Spec) (string, error) WatchRead(ctx context.Context, interval time.Duration, s Spec) error WatchList(ctx context.Context, interval time.Duration, s ListSpec, keyword SearchParams) error WatchListAll(ctx context.Context, interval time.Duration, s CountableListSpec, keyword SearchParams) error }
type CommonSearchParams ¶
type CommonSearchParams struct { Type SearchType `url:"type,omitempty"` Offset int32 `url:"offset,omitempty"` Limit int32 `url:"limit,omitempty"` }
func (*CommonSearchParams) GetLimit ¶
func (k *CommonSearchParams) GetLimit() int32
func (*CommonSearchParams) GetOffset ¶
func (k *CommonSearchParams) GetOffset() int32
func (*CommonSearchParams) GetType ¶
func (k *CommonSearchParams) GetType() SearchType
func (*CommonSearchParams) SetLimit ¶
func (k *CommonSearchParams) SetLimit(limit int32)
func (*CommonSearchParams) SetOffset ¶
func (k *CommonSearchParams) SetOffset(offset int32)
func (*CommonSearchParams) SetType ¶
func (k *CommonSearchParams) SetType(t SearchType)
type CountableListSpec ¶
type CountableListSpec interface { ListSpec SetCount(int32) GetCount() int32 GetMaxLimit() int32 AddItem(interface{}) bool ClearItems() }
func DeepCopyCountableListSpec ¶ added in v0.6.0
func DeepCopyCountableListSpec(s CountableListSpec) CountableListSpec
type ErrorDetail ¶
func (ErrorDetail) Error ¶
func (e ErrorDetail) Error() string
type ErrorDetails ¶
type ErrorDetails []ErrorDetail
func (ErrorDetails) Error ¶
func (e ErrorDetails) Error() string
type Initializer ¶
type Initializer interface {
Init()
}
type JSONAPIAdapter ¶ added in v0.8.0
type JSONAPIAdapter struct { Read jsoniter.API Update jsoniter.API Create jsoniter.API Apply jsoniter.API JSON jsoniter.API }
func NewJSONAPIAdapter ¶ added in v0.8.0
func NewJSONAPIAdapter() *JSONAPIAdapter
func (*JSONAPIAdapter) MarshalApply ¶ added in v0.8.0
func (j *JSONAPIAdapter) MarshalApply(body interface{}) ([]byte, error)
Marshal for apply request.
func (*JSONAPIAdapter) MarshalCreate ¶ added in v0.8.0
func (j *JSONAPIAdapter) MarshalCreate(body interface{}) ([]byte, error)
Marshal for create request.
func (*JSONAPIAdapter) MarshalOutput ¶ added in v0.8.0
func (j *JSONAPIAdapter) MarshalOutput(spec Spec) ([]byte, error)
Marshal for file format.
func (*JSONAPIAdapter) MarshalUpdate ¶ added in v0.8.0
func (j *JSONAPIAdapter) MarshalUpdate(body interface{}) ([]byte, error)
Marshal for update request.
func (*JSONAPIAdapter) UnMarshalInput ¶ added in v0.8.0
func (j *JSONAPIAdapter) UnMarshalInput(bs []byte, obj Object) error
UnMarshal for file format.
func (*JSONAPIAdapter) UnmarshalRead ¶ added in v0.8.0
func (j *JSONAPIAdapter) UnmarshalRead(bs []byte, o interface{}) error
Unmarshal api response.
type JSONAPIInterface ¶ added in v0.8.0
type JSONFileInterface ¶ added in v0.8.0
type KeywordsBoolean ¶
+k8s:deepcopy-gen=false
func (KeywordsBoolean) EncodeValues ¶
func (c KeywordsBoolean) EncodeValues(key string, v *url.Values) error
type KeywordsFavorite ¶
+k8s:deepcopy-gen=false
func (KeywordsFavorite) EncodeValues ¶
func (c KeywordsFavorite) EncodeValues(key string, v *url.Values) error
type KeywordsID ¶ added in v0.6.1
type KeywordsID []int64
+k8s:deepcopy-gen=false
func (KeywordsID) Validate ¶ added in v0.6.1
func (s KeywordsID) Validate() bool
type KeywordsLabels ¶ added in v0.8.0
type KeywordsLabels []Label
+k8s:deepcopy-gen=false
func (KeywordsLabels) EncodeValues ¶ added in v0.8.0
func (c KeywordsLabels) EncodeValues(key string, v *url.Values) error
type KeywordsState ¶
+k8s:deepcopy-gen=false
func (KeywordsState) EncodeValues ¶
func (c KeywordsState) EncodeValues(key string, v *url.Values) error
type KeywordsString ¶
type KeywordsString []string
+k8s:deepcopy-gen=false
func (KeywordsString) Validate ¶
func (s KeywordsString) Validate() bool
type ListSpec ¶
type ListSpec interface { Spec Initializer GetItems() interface{} Len() int Index(int) interface{} }
func DeepCopyListSpec ¶ added in v0.6.0
type Logger ¶
type Logger interface { Tracef(format string, args ...interface{}) Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
logger interface.
type OutputFrame ¶
type OutputFrame struct { meta.KindVersion `json:",inline"` Resource Object `json:"resource"` }
file format frame.
type RateRoundTripper ¶ added in v0.9.0
type RateRoundTripper struct { RroundTripper http.RoundTripper Limiter *rate.Limiter }
func NewRateRoundTripper ¶ added in v0.9.0
func NewRateRoundTripper(rt http.RoundTripper, limiter *rate.Limiter) *RateRoundTripper
type RawResponse ¶
type RawResponse struct { ResponseCommon `read:",inline"` Result json.RawMessage `read:"result,omitempty"` Results json.RawMessage `read:"results,omitempty"` }
type RequestInfo ¶
type ResponseCommon ¶
type ResponseCommon struct {
RequestID string `read:"request_id"`
}
type ResponseInfo ¶
type RowSearchParams ¶
func NewRowSearchParams ¶
func NewRowSearchParams(queryString string) (*RowSearchParams, error)
func (RowSearchParams) GetLimit ¶
func (r RowSearchParams) GetLimit() int32
func (RowSearchParams) GetOffset ¶
func (r RowSearchParams) GetOffset() int32
func (RowSearchParams) SetLimit ¶
func (r RowSearchParams) SetLimit(limit int32)
func (RowSearchParams) SetOffset ¶
func (r RowSearchParams) SetOffset(offset int32)
type SearchLimit ¶
type SearchLimit int32
+k8s:deepcopy-gen=false
func (SearchLimit) Validate ¶
func (s SearchLimit) Validate() bool
type SearchOffset ¶
type SearchOffset int32
+k8s:deepcopy-gen=false
func (SearchOffset) Validate ¶
func (s SearchOffset) Validate() bool
type SearchOrder ¶
type SearchOrder string
+k8s:deepcopy-gen=false
const ( SearchOrderASC SearchOrder = "ASC" SearchOrderDESC SearchOrder = "DESC" )
func (SearchOrder) Validate ¶
func (s SearchOrder) Validate() bool
type SearchParams ¶
type SearchType ¶
type SearchType string
+k8s:deepcopy-gen=false
const ( SearchTypeAND SearchType = "AND" SearchTypeOR SearchType = "OR" )
func (SearchType) Validate ¶
func (s SearchType) Validate() bool
type Spec ¶
type Spec interface { Object GetName() string GetGroup() string GetPathMethod(Action) (string, string) }
func DeepCopySpec ¶ added in v0.6.0
type StdLogger ¶
simple logger change better logger as you like.
func NewStdLogger ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.