Documentation ¶
Overview ¶
Package services contains the client for working with service catalog service instances.
Index ¶
- Constants
- func AssertJSONMap(jsonString []byte) (json.RawMessage, error)
- func ConditionDeleted(_ *v1beta1.ServiceInstance, apiErr error) (bool, error)
- func ExtractConditions(obj *v1beta1.ServiceInstance) (extracted []apis.Condition)
- func FormatDiff(w io.Writer, leftName, rightName string, left, right *v1beta1.ServiceInstance)
- func LastStatusCondition(si v1beta1.ServiceInstance) v1beta1.ServiceInstanceCondition
- func ObservedGenerationMatchesGeneration(obj *v1beta1.ServiceInstance) bool
- func ParseJSONOrFile(jsonOrFile string) (json.RawMessage, error)
- func ProvisionSuccess(obj *v1beta1.ServiceInstance, err error) (bool, error)
- type Client
- type ClientExtension
- type ConditionFuncE
- type CreateOption
- type CreateOptions
- type DeleteOption
- type DeleteOptions
- type GetOption
- type GetOptions
- type List
- type ListOption
- type ListOptions
- type Merger
- type Mutator
- type Predicate
- type UpdateOption
- type UpdateOptions
Examples ¶
Constants ¶
const ( // Kind contains the kind for the backing Kubernetes API. Kind = "ServiceInstance" // APIVersion contains the version for the backing Kubernetes API. APIVersion = "v1beta1" )
Variables ¶
This section is empty.
Functions ¶
func AssertJSONMap ¶ added in v0.2.0
func AssertJSONMap(jsonString []byte) (json.RawMessage, error)
AssertJSONMap asserts that the string is a JSON map.
func ConditionDeleted ¶ added in v0.2.0
func ConditionDeleted(_ *v1beta1.ServiceInstance, apiErr error) (bool, error)
ConditionDeleted is a ConditionFuncE that succeeds if the error returned by the cluster was a not found error.
func ExtractConditions ¶ added in v0.2.0
func ExtractConditions(obj *v1beta1.ServiceInstance) (extracted []apis.Condition)
ExtractConditions converts the native condition types into an apis.Condition array with the Type, Status, Reason, and Message fields intact.
func FormatDiff ¶ added in v0.2.0
func FormatDiff(w io.Writer, leftName, rightName string, left, right *v1beta1.ServiceInstance)
FormatDiff creates a diff between two v1beta1.ServiceInstances and writes it to the given writer.
func LastStatusCondition ¶
func LastStatusCondition(si v1beta1.ServiceInstance) v1beta1.ServiceInstanceCondition
LastStatusCondition returns the last condition based on time.
Example ¶
si := v1beta1.ServiceInstance{ Status: v1beta1.ServiceInstanceStatus{ Conditions: []v1beta1.ServiceInstanceCondition{ {Status: "Wrong"}, {LastTransitionTime: metav1.Time{Time: time.Now()}, Status: "Ready"}, }, }, } c := LastStatusCondition(si) fmt.Println(c.Status)
Output: Ready
func ObservedGenerationMatchesGeneration ¶ added in v0.2.0
func ObservedGenerationMatchesGeneration(obj *v1beta1.ServiceInstance) bool
ObservedGenerationMatchesGeneration is a predicate that returns true if the object's ObservedGeneration matches the genration of the object.
func ParseJSONOrFile ¶
func ParseJSONOrFile(jsonOrFile string) (json.RawMessage, error)
ParseJSONOrFile parses the value as JSON if it's valid or else it tries to read the value as a file on the filesystem.
func ProvisionSuccess ¶ added in v0.2.0
func ProvisionSuccess(obj *v1beta1.ServiceInstance, err error) (bool, error)
ProvisionSuccess implements ConditionFuncE and can be used to wait until an instance is successfully provisioned or fails.
Types ¶
type Client ¶
type Client interface { Create(namespace string, obj *v1beta1.ServiceInstance, opts ...CreateOption) (*v1beta1.ServiceInstance, error) Update(namespace string, obj *v1beta1.ServiceInstance, opts ...UpdateOption) (*v1beta1.ServiceInstance, error) Transform(namespace string, name string, transformer Mutator) (*v1beta1.ServiceInstance, error) Get(namespace string, name string, opts ...GetOption) (*v1beta1.ServiceInstance, error) Delete(namespace string, name string, opts ...DeleteOption) error List(namespace string, opts ...ListOption) ([]v1beta1.ServiceInstance, error) Upsert(namespace string, newObj *v1beta1.ServiceInstance, merge Merger) (*v1beta1.ServiceInstance, error) WaitFor(ctx context.Context, namespace string, name string, interval time.Duration, condition Predicate) (*v1beta1.ServiceInstance, error) WaitForE(ctx context.Context, namespace string, name string, interval time.Duration, condition ConditionFuncE) (*v1beta1.ServiceInstance, error) // Utility functions WaitForDeletion(ctx context.Context, namespace string, name string, interval time.Duration) (*v1beta1.ServiceInstance, error) // ClientExtension can be used by the developer to extend the client. ClientExtension }
Client is the interface for interacting with v1beta1.ServiceInstance types as Service CF style objects.
func NewClient ¶
func NewClient(kclient cv1beta1.ServiceInstancesGetter) Client
NewClient creates a new service client.
type ClientExtension ¶ added in v0.2.0
type ClientExtension interface {
WaitForProvisionSuccess(ctx context.Context, namespace string, name string, interval time.Duration) (instance *v1beta1.ServiceInstance, err error)
}
ClientExtension holds additional functions that should be exposed by client.
type ConditionFuncE ¶ added in v0.2.0
type ConditionFuncE func(instance *v1beta1.ServiceInstance, apiErr error) (done bool, err error)
ConditionFuncE is a callback used by WaitForE. Done should be set to true once the condition succeeds and shouldn't be called anymore. The error will be passed back to the user.
This function MAY retrieve a nil instance and an apiErr. It's up to the function to decide how to handle the apiErr.
type CreateOption ¶ added in v0.2.0
type CreateOption func(*createConfig)
CreateOption is a single option for configuring a createConfig
type CreateOptions ¶ added in v0.2.0
type CreateOptions []CreateOption
CreateOptions is a configuration set defining a createConfig
func CreateOptionDefaults ¶ added in v0.2.0
func CreateOptionDefaults() CreateOptions
CreateOptionDefaults gets the default values for Create.
func (CreateOptions) Extend ¶ added in v0.2.0
func (opts CreateOptions) Extend(other CreateOptions) CreateOptions
Extend creates a new CreateOptions with the contents of other overriding the values set in this CreateOptions.
type DeleteOption ¶ added in v0.2.0
type DeleteOption func(*deleteConfig)
DeleteOption is a single option for configuring a deleteConfig
func WithDeleteForegroundDeletion ¶ added in v0.2.0
func WithDeleteForegroundDeletion(val bool) DeleteOption
WithDeleteForegroundDeletion creates an Option that sets If the resource should be deleted in the foreground.
type DeleteOptions ¶ added in v0.2.0
type DeleteOptions []DeleteOption
DeleteOptions is a configuration set defining a deleteConfig
func DeleteOptionDefaults ¶ added in v0.2.0
func DeleteOptionDefaults() DeleteOptions
DeleteOptionDefaults gets the default values for Delete.
func (DeleteOptions) Extend ¶ added in v0.2.0
func (opts DeleteOptions) Extend(other DeleteOptions) DeleteOptions
Extend creates a new DeleteOptions with the contents of other overriding the values set in this DeleteOptions.
func (DeleteOptions) ForegroundDeletion ¶ added in v0.2.0
func (opts DeleteOptions) ForegroundDeletion() bool
ForegroundDeletion returns the last set value for ForegroundDeletion or the empty value if not set.
type GetOption ¶ added in v0.2.0
type GetOption func(*getConfig)
GetOption is a single option for configuring a getConfig
type GetOptions ¶ added in v0.2.0
type GetOptions []GetOption
GetOptions is a configuration set defining a getConfig
func GetOptionDefaults ¶ added in v0.2.0
func GetOptionDefaults() GetOptions
GetOptionDefaults gets the default values for Get.
func (GetOptions) Extend ¶ added in v0.2.0
func (opts GetOptions) Extend(other GetOptions) GetOptions
Extend creates a new GetOptions with the contents of other overriding the values set in this GetOptions.
type List ¶ added in v0.2.0
type List []v1beta1.ServiceInstance
List represents a collection of v1beta1.ServiceInstance.
type ListOption ¶ added in v0.2.0
type ListOption func(*listConfig)
ListOption is a single option for configuring a listConfig
func WithListFieldSelector ¶ added in v0.2.0
func WithListFieldSelector(val map[string]string) ListOption
WithListFieldSelector creates an Option that sets A selector on the resource's fields.
func WithListFilter ¶ added in v0.2.0
func WithListFilter(val Predicate) ListOption
WithListFilter creates an Option that sets Filter to apply.
type ListOptions ¶ added in v0.2.0
type ListOptions []ListOption
ListOptions is a configuration set defining a listConfig
func ListOptionDefaults ¶ added in v0.2.0
func ListOptionDefaults() ListOptions
ListOptionDefaults gets the default values for List.
func (ListOptions) Extend ¶ added in v0.2.0
func (opts ListOptions) Extend(other ListOptions) ListOptions
Extend creates a new ListOptions with the contents of other overriding the values set in this ListOptions.
type Merger ¶ added in v0.2.0
type Merger func(newObj, oldObj *v1beta1.ServiceInstance) *v1beta1.ServiceInstance
Merger is a type to merge an existing value with a new one.
type Mutator ¶ added in v0.2.0
type Mutator func(*v1beta1.ServiceInstance) error
Mutator is a function that changes v1beta1.ServiceInstance.
type Predicate ¶ added in v0.2.0
type Predicate func(*v1beta1.ServiceInstance) bool
Predicate is a boolean function for a v1beta1.ServiceInstance.
type UpdateOption ¶ added in v0.2.0
type UpdateOption func(*updateConfig)
UpdateOption is a single option for configuring a updateConfig
type UpdateOptions ¶ added in v0.2.0
type UpdateOptions []UpdateOption
UpdateOptions is a configuration set defining a updateConfig
func UpdateOptionDefaults ¶ added in v0.2.0
func UpdateOptionDefaults() UpdateOptions
UpdateOptionDefaults gets the default values for Update.
func (UpdateOptions) Extend ¶ added in v0.2.0
func (opts UpdateOptions) Extend(other UpdateOptions) UpdateOptions
Extend creates a new UpdateOptions with the contents of other overriding the values set in this UpdateOptions.