Documentation ¶
Index ¶
- Constants
- func CanonicalLinkRelation(rel string) string
- func IsUnauthorized(err error) bool
- func UnmarshalJSON(b []byte, v interface{}) error
- func UnmarshalMetadata(resp *http.Response, md *Metadata)
- type Client
- type Duration
- type Error
- type ErrorType
- type IndexQuery
- type Metadata
- type NumberOrString
Constants ¶
const ( ParamOffset = "offset" ParamLimit = "limit" ParamLabelSelector = "labelSelector" )
const ( RelationSelf = "self" RelationNext = "next" RelationPrev = "prev" RelationAlternate = "alternate" RelationUp = "up" RelationExperiments = "https://stormforge.io/rel/experiments" RelationLabels = "https://stormforge.io/rel/labels" RelationNextTrial = "https://stormforge.io/rel/next-trial" RelationRecommendations = "https://stormforge.io/rel/recommendations" RelationScenarios = "https://stormforge.io/rel/scenarios" RelationTemplate = "https://stormforge.io/rel/template" RelationTrials = "https://stormforge.io/rel/trials" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalLinkRelation ¶ added in v0.0.11
CanonicalLinkRelation returns the supplied link relation name normalized for previously accepted values. The returned value can be compared case-insensitively to the supplied `Relation*` constants.
func IsUnauthorized ¶ added in v0.0.11
IsUnauthorized checks to see if the error is an "unauthorized" error.
func UnmarshalJSON ¶ added in v0.0.11
UnmarshalJSON extracts the supplied JSON, preserving the "_metadata" field if necessary. This should only be necessary on items in index (list) representations as top-level "_metadata" fields should normally be populated from HTTP headers.
func UnmarshalMetadata ¶ added in v0.0.15
Types ¶
type Client ¶
type Client interface { // URL returns the location of the specified endpoint. URL(endpoint string) *url.URL // Do sends an HTTP request and returns the buffered body contents. Do(context.Context, *http.Request) (*http.Response, []byte, error) }
Client is used to handle interactions with the API Server.
type Duration ¶ added in v0.0.25
Duration is an alternate duration type that marshals as a JSON string.
func (Duration) MarshalJSON ¶ added in v0.0.25
MarshalJSON produces a string formatted duration.
func (*Duration) UnmarshalJSON ¶ added in v0.0.25
UnmarshalJSON handles the string formatted duration.
type Error ¶ added in v0.0.11
type Error struct { Type ErrorType `json:"-"` Message string `json:"error"` RetryAfter time.Duration `json:"-"` Location string `json:"-"` }
Error represents the API specific error messages and may be used in response to HTTP status codes
func NewError ¶ added in v0.0.11
NewError returns a new error with an API specific error condition, it also captures the details of the response
func NewUnexpectedError ¶ added in v0.0.11
NewUnexpectedError returns an error in situations where the API returned an undocumented status for the requested resource.
type ErrorType ¶ added in v0.0.11
type ErrorType string
ErrorType is an identifying token for errors.
const ( ErrUnexpected ErrorType = "unexpected" )
type IndexQuery ¶ added in v0.0.11
IndexQuery represents the query parameter of an index resource.
func (*IndexQuery) AppendToURL ¶ added in v0.0.15
func (q *IndexQuery) AppendToURL(u string) (string, error)
AppendToURL adds this index query to an existing URL.
func (*IndexQuery) SetLabelSelector ¶ added in v0.0.11
func (q *IndexQuery) SetLabelSelector(kv map[string]string)
SetLabelSelector is a helper to set label selectors used to filter the index.
func (*IndexQuery) SetLimit ¶ added in v0.0.11
func (q *IndexQuery) SetLimit(limit int)
SetLimit sets the maximum number of items to include with the index.
func (*IndexQuery) SetOffset ¶ added in v0.0.11
func (q *IndexQuery) SetOffset(offset int)
SetOffset sets the number of items to skip from the beginning of the index.
type Metadata ¶ added in v0.0.11
Metadata is used to hold single or multi-value metadata from list responses.
func (Metadata) LastModified ¶ added in v0.0.11
type NumberOrString ¶ added in v0.0.15
NumberOrString is value that can be a JSON number or string.
func FromFloat64 ¶ added in v0.0.15
func FromFloat64(val float64) NumberOrString
FromFloat64 returns the supplied value as a NumberOrString
func FromInt64 ¶ added in v0.0.15
func FromInt64(val int64) NumberOrString
FromInt64 returns the supplied value as a NumberOrString
func FromNumber ¶ added in v0.0.15
func FromNumber(val json.Number) NumberOrString
FromNumber returns the supplied value as a NumberOrString
func FromString ¶ added in v0.0.15
func FromString(val string) NumberOrString
FromString returns the supplied value as a NumberOrString
func FromValue ¶ added in v0.1.7
func FromValue(val string) NumberOrString
FromValue returns the supplied value as a NumberOrString based on an attempt to parse the supplied value as an int or float.
func (*NumberOrString) Float64Value ¶ added in v0.0.15
func (s *NumberOrString) Float64Value() float64
Float64Value coerces the value to a float64.
func (*NumberOrString) Int64Value ¶ added in v0.0.15
func (s *NumberOrString) Int64Value() int64
Int64Value coerces the value to an int64.
func (NumberOrString) MarshalJSON ¶ added in v0.0.15
func (s NumberOrString) MarshalJSON() ([]byte, error)
MarshalJSON writes the value with the appropriate type.
func (*NumberOrString) Quantity ¶ added in v0.1.7
func (s *NumberOrString) Quantity() *big.Float
Quantity attempts to return a big float using the same logic as a Kubernetes quantity. If parsing fails, this will return nil.
func (*NumberOrString) String ¶ added in v0.0.15
func (s *NumberOrString) String() string
String coerces the value to a string.
func (*NumberOrString) UnmarshalJSON ¶ added in v0.0.15
func (s *NumberOrString) UnmarshalJSON(b []byte) error
UnmarshalJSON reads the value from either a string or number.