servicecatalog

package
v3.11.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FieldExternalPlanName is the jsonpath to a plan's external name.
	FieldExternalPlanName = "spec.externalName"

	// FieldServiceClassRef is the jsonpath to a plan's associated class name.
	FieldServiceClassRef = "spec.clusterServiceClassRef.name"
)
View Source
const (
	// ClusterScope filters resources to those defined at the cluster-scope.
	ClusterScope = "cluster"

	// NamespaceScope filters resources to those defined within a namespace.
	NamespaceScope = "namespace"

	// AllScope combines all resources at both the cluster and namespace scopes.
	AllScope = "all"
)
View Source
const (
	// FieldExternalClassName is the jsonpath to a class's external name.
	FieldExternalClassName = "spec.externalName"
)
View Source
const (
	// FieldServicePlanRef is the jsonpath to an instance's plan name (uuid).
	FieldServicePlanRef = "spec.clusterServicePlanRef.name"
)

Variables

This section is empty.

Functions

func BuildParameters

func BuildParameters(params interface{}) *runtime.RawExtension

BuildParameters converts a map of variable assignments to a byte encoded json document, which is what the ServiceCatalog API consumes.

func BuildParametersFrom

func BuildParametersFrom(secrets map[string]string) []v1beta1.ParametersFromSource

BuildParametersFrom converts a map of secrets names to secret keys to the type consumed by the ServiceCatalog API.

func GetBindingStatusCondition

func GetBindingStatusCondition(status v1beta1.ServiceBindingStatus) v1beta1.ServiceBindingCondition

GetBindingStatusCondition returns the last condition on a binding status. When no conditions exist, an empty condition is returned.

Types

type Broker

type Broker interface {

	// GetName returns the broker's name.
	GetName() string

	// GetNamespace returns the broker's namespace, or "" if it's cluster-scoped.
	GetNamespace() string

	// GetURL returns the broker's URL.
	GetURL() string

	// GetStatus returns the broker's status.
	GetStatus() v1beta1.CommonServiceBrokerStatus
}

Broker provides a unifying layer of cluster and namespace scoped broker resources.

type Class

type Class interface {

	// GetName returns the class's name.
	GetName() string

	// GetNamespace returns the class's namespace, or "" if it's cluster-scoped.
	GetNamespace() string

	// GetExternalName returns the class's external name.
	GetExternalName() string

	// GetDescription returns the class description.
	GetDescription() string
}

Class provides a unifying layer of cluster and namespace scoped class resources.

type FilterOptions

type FilterOptions struct {
	ClassID string
}

FilterOptions allows for optional filtering fields to be passed to `Retrieve` methods.

type Plan

type Plan interface {

	// GetName returns the plan's name.
	GetName() string

	// GetNamespace returns the plan's namespace, or "" if it's cluster-scoped.
	GetNamespace() string

	// GetExternalName returns the plan's external name.
	GetExternalName() string

	// GetDescription returns the plan description.
	GetDescription() string

	// GetClassID returns the plan's class name.
	GetClassID() string
}

Plan provides a unifying layer of cluster and namespace scoped plan resources.

type RegisterOptions

type RegisterOptions struct {
	BasicSecret       string
	BearerSecret      string
	CAFile            string
	ClassRestrictions []string
	Namespace         string
	PlanRestrictions  []string
	RelistBehavior    v1beta1.ServiceBrokerRelistBehavior
	RelistDuration    *metav1.Duration
	SkipTLS           bool
}

RegisterOptions allows for passing of optional fields to the broker Register method.

type RetrievePlanOptions

type RetrievePlanOptions struct {
	ClassID   string
	Namespace string
	Scope     Scope
}

RetrievePlanOptions allows to specify which plans will be retrieved

type SDK

type SDK struct {
	K8sClient            kubernetes.Interface
	ServiceCatalogClient clientset.Interface
}

SDK wrapper around the generated Go client for the Kubernetes Service Catalog

func (*SDK) Bind

func (sdk *SDK) Bind(namespace, bindingName, externalID, instanceName, secretName string,
	params interface{}, secrets map[string]string) (*v1beta1.ServiceBinding, error)

Bind an instance to a secret.

func (*SDK) BindingParentHierarchy

BindingParentHierarchy retrieves all ancestor resources of a binding.

func (*SDK) Core

func (sdk *SDK) Core() corev1.CoreV1Interface

Core is the underlying generated Core API versioned interface It should be used instead of accessing the client directly.

func (*SDK) CreateClass

func (sdk *SDK) CreateClass(class *v1beta1.ClusterServiceClass) (*v1beta1.ClusterServiceClass, error)

CreateClass returns new created class

func (*SDK) DeleteBinding

func (sdk *SDK) DeleteBinding(ns, bindingName string) error

DeleteBinding by name.

func (*SDK) DeleteBindings

func (sdk *SDK) DeleteBindings(bindings []types.NamespacedName) ([]types.NamespacedName, error)

DeleteBindings deletes bindings by name.

func (*SDK) Deprovision

func (sdk *SDK) Deprovision(namespace, instanceName string) error

Deprovision deletes an instance.

func (*SDK) Deregister

func (sdk *SDK) Deregister(brokerName string) error

Deregister deletes a broker

func (*SDK) InstanceHasStatus

func (sdk *SDK) InstanceHasStatus(instance *v1beta1.ServiceInstance, status v1beta1.ServiceInstanceConditionType) bool

InstanceHasStatus returns if the instance is in the specified status.

func (*SDK) InstanceParentHierarchy

InstanceParentHierarchy retrieves all ancestor resources of an instance.

func (*SDK) InstanceToServiceClassAndPlan

func (sdk *SDK) InstanceToServiceClassAndPlan(instance *v1beta1.ServiceInstance,
) (*v1beta1.ClusterServiceClass, *v1beta1.ClusterServicePlan, error)

InstanceToServiceClassAndPlan retrieves the parent class and plan for an instance.

func (*SDK) IsBindingFailed

func (sdk *SDK) IsBindingFailed(binding *v1beta1.ServiceBinding) bool

IsBindingFailed returns true if the instance is in the Failed status.

func (*SDK) IsBindingReady

func (sdk *SDK) IsBindingReady(binding *v1beta1.ServiceBinding) bool

IsBindingReady returns true if the instance is in the Ready status.

func (*SDK) IsInstanceFailed

func (sdk *SDK) IsInstanceFailed(instance *v1beta1.ServiceInstance) bool

IsInstanceFailed returns if the instance is in the Failed status.

func (*SDK) IsInstanceReady

func (sdk *SDK) IsInstanceReady(instance *v1beta1.ServiceInstance) bool

IsInstanceReady returns if the instance is in the Ready status.

func (*SDK) Provision

func (sdk *SDK) Provision(namespace, instanceName, externalID, className, planName string,
	params interface{}, secrets map[string]string) (*v1beta1.ServiceInstance, error)

Provision creates an instance of a service class and plan.

func (*SDK) Register

func (sdk *SDK) Register(brokerName string, url string, opts *RegisterOptions) (*v1beta1.ClusterServiceBroker, error)

Register creates a broker

func (*SDK) RetrieveBinding

func (sdk *SDK) RetrieveBinding(ns, name string) (*v1beta1.ServiceBinding, error)

RetrieveBinding gets a binding by its name.

func (*SDK) RetrieveBindings

func (sdk *SDK) RetrieveBindings(ns string) (*v1beta1.ServiceBindingList, error)

RetrieveBindings lists all bindings in a namespace.

func (*SDK) RetrieveBindingsByInstance

func (sdk *SDK) RetrieveBindingsByInstance(instance *v1beta1.ServiceInstance,
) ([]v1beta1.ServiceBinding, error)

RetrieveBindingsByInstance gets all child bindings for an instance.

func (*SDK) RetrieveBroker

func (sdk *SDK) RetrieveBroker(name string) (*v1beta1.ClusterServiceBroker, error)

RetrieveBroker gets a broker by its name.

func (*SDK) RetrieveBrokerByClass

func (sdk *SDK) RetrieveBrokerByClass(class *v1beta1.ClusterServiceClass,
) (*v1beta1.ClusterServiceBroker, error)

RetrieveBrokerByClass gets the parent broker of a class.

func (*SDK) RetrieveBrokers

func (sdk *SDK) RetrieveBrokers(opts ScopeOptions) ([]Broker, error)

RetrieveBrokers lists all brokers defined in the cluster.

func (*SDK) RetrieveClassByID

func (sdk *SDK) RetrieveClassByID(uuid string) (*v1beta1.ClusterServiceClass, error)

RetrieveClassByID gets a class by its UUID.

func (*SDK) RetrieveClassByName

func (sdk *SDK) RetrieveClassByName(name string) (*v1beta1.ClusterServiceClass, error)

RetrieveClassByName gets a class by its external name.

func (*SDK) RetrieveClassByPlan

func (sdk *SDK) RetrieveClassByPlan(plan *v1beta1.ClusterServicePlan,
) (*v1beta1.ClusterServiceClass, error)

RetrieveClassByPlan gets the class associated to a plan.

func (*SDK) RetrieveClasses

func (sdk *SDK) RetrieveClasses(opts ScopeOptions) ([]Class, error)

RetrieveClasses lists all classes defined in the cluster.

func (*SDK) RetrieveInstance

func (sdk *SDK) RetrieveInstance(ns, name string) (*v1beta1.ServiceInstance, error)

RetrieveInstance gets an instance by its name.

func (*SDK) RetrieveInstanceByBinding

func (sdk *SDK) RetrieveInstanceByBinding(b *v1beta1.ServiceBinding,
) (*v1beta1.ServiceInstance, error)

RetrieveInstanceByBinding retrieves the parent instance for a binding.

func (*SDK) RetrieveInstances

func (sdk *SDK) RetrieveInstances(ns, classFilter, planFilter string) (*v1beta1.ServiceInstanceList, error)

RetrieveInstances lists all instances in a namespace.

func (*SDK) RetrieveInstancesByPlan

func (sdk *SDK) RetrieveInstancesByPlan(plan *v1beta1.ClusterServicePlan,
) ([]v1beta1.ServiceInstance, error)

RetrieveInstancesByPlan retrieves all instances of a plan.

func (*SDK) RetrievePlanByClassAndPlanNames

func (sdk *SDK) RetrievePlanByClassAndPlanNames(className, planName string,
) (*v1beta1.ClusterServicePlan, error)

RetrievePlanByClassAndPlanNames gets a plan by its class/plan name combination.

func (*SDK) RetrievePlanByID

func (sdk *SDK) RetrievePlanByID(uuid string) (*v1beta1.ClusterServicePlan, error)

RetrievePlanByID gets a plan by its UUID.

func (*SDK) RetrievePlanByName

func (sdk *SDK) RetrievePlanByName(name string) (*v1beta1.ClusterServicePlan, error)

RetrievePlanByName gets a plan by its external name.

func (*SDK) RetrievePlans

func (sdk *SDK) RetrievePlans(opts RetrievePlanOptions) ([]Plan, error)

RetrievePlans lists all plans defined in the cluster.

func (*SDK) RetrieveSecretByBinding

func (sdk *SDK) RetrieveSecretByBinding(binding *v1beta1.ServiceBinding) (*corev1.Secret, error)

RetrieveSecretByBinding gets the secret associated with a binding A nil secret is returned without error when the secret has not been created by Service Catalog yet. An error is returned when the binding is Ready but the secret could not be retrieved.

func (*SDK) ServerVersion

func (sdk *SDK) ServerVersion() (*version.Info, error)

ServerVersion asks the Service Catalog API Server for the version.Info object and returns it.

func (*SDK) ServiceCatalog

func (sdk *SDK) ServiceCatalog() v1beta1.ServicecatalogV1beta1Interface

ServiceCatalog is the underlying generated Service Catalog versioned interface It should be used instead of accessing the client directly.

func (*SDK) Sync

func (sdk *SDK) Sync(name string, retries int) error

Sync or relist a broker to refresh its catalog metadata.

func (*SDK) TouchInstance

func (sdk *SDK) TouchInstance(ns, name string, retries int) error

TouchInstance increments the updateRequests field on an instance to make service process it again (might be an update, delete, or noop)

func (*SDK) Unbind

func (sdk *SDK) Unbind(ns, instanceName string) ([]types.NamespacedName, error)

Unbind deletes all bindings associated to an instance.

func (*SDK) WaitForBinding

func (sdk *SDK) WaitForBinding(ns, name string, interval time.Duration, timeout *time.Duration) (binding *v1beta1.ServiceBinding, err error)

WaitForBinding waits for the instance to complete the current operation (or fail).

func (*SDK) WaitForInstance

func (sdk *SDK) WaitForInstance(ns, name string, interval time.Duration, timeout *time.Duration) (instance *v1beta1.ServiceInstance, err error)

WaitForInstance waits for the instance to complete the current operation (or fail).

func (*SDK) WaitForInstanceToNotExist

func (sdk *SDK) WaitForInstanceToNotExist(ns, name string, interval time.Duration, timeout *time.Duration) (instance *v1beta1.ServiceInstance, err error)

WaitForInstanceToNotExist waits for the specified instance to no longer exist.

type Scope

type Scope string

Scope is an enum that represents filtering resources by their scope (cluster vs. namespace).

func (Scope) Matches

func (s Scope) Matches(value Scope) bool

Matches determines if a particular value is included in the scope.

type ScopeOptions

type ScopeOptions struct {
	Namespace string
	Scope     Scope
}

ScopeOptions allows for filtering results based on it's namespace and scope (cluster vs. namespaced).

type SvcatClient

type SvcatClient interface {
	Bind(string, string, string, string, string, interface{}, map[string]string) (*apiv1beta1.ServiceBinding, error)
	BindingParentHierarchy(*apiv1beta1.ServiceBinding) (*apiv1beta1.ServiceInstance, *apiv1beta1.ClusterServiceClass, *apiv1beta1.ClusterServicePlan, *apiv1beta1.ClusterServiceBroker, error)
	DeleteBinding(string, string) error
	DeleteBindings([]types.NamespacedName) ([]types.NamespacedName, error)
	IsBindingFailed(*apiv1beta1.ServiceBinding) bool
	IsBindingReady(*apiv1beta1.ServiceBinding) bool
	RetrieveBinding(string, string) (*apiv1beta1.ServiceBinding, error)
	RetrieveBindings(string) (*apiv1beta1.ServiceBindingList, error)
	RetrieveBindingsByInstance(*apiv1beta1.ServiceInstance) ([]apiv1beta1.ServiceBinding, error)
	Unbind(string, string) ([]types.NamespacedName, error)
	WaitForBinding(string, string, time.Duration, *time.Duration) (*apiv1beta1.ServiceBinding, error)

	Deregister(string) error
	RetrieveBrokers(opts ScopeOptions) ([]Broker, error)
	RetrieveBroker(string) (*apiv1beta1.ClusterServiceBroker, error)
	RetrieveBrokerByClass(*apiv1beta1.ClusterServiceClass) (*apiv1beta1.ClusterServiceBroker, error)
	Register(string, string, *RegisterOptions) (*apiv1beta1.ClusterServiceBroker, error)
	Sync(string, int) error

	RetrieveClasses(ScopeOptions) ([]Class, error)
	RetrieveClassByName(string) (*apiv1beta1.ClusterServiceClass, error)
	RetrieveClassByID(string) (*apiv1beta1.ClusterServiceClass, error)
	RetrieveClassByPlan(*apiv1beta1.ClusterServicePlan) (*apiv1beta1.ClusterServiceClass, error)
	CreateClass(*apiv1beta1.ClusterServiceClass) (*apiv1beta1.ClusterServiceClass, error)

	Deprovision(string, string) error
	InstanceParentHierarchy(*apiv1beta1.ServiceInstance) (*apiv1beta1.ClusterServiceClass, *apiv1beta1.ClusterServicePlan, *apiv1beta1.ClusterServiceBroker, error)
	InstanceToServiceClassAndPlan(*apiv1beta1.ServiceInstance) (*apiv1beta1.ClusterServiceClass, *apiv1beta1.ClusterServicePlan, error)
	IsInstanceFailed(*apiv1beta1.ServiceInstance) bool
	IsInstanceReady(*apiv1beta1.ServiceInstance) bool
	Provision(string, string, string, string, string, interface{}, map[string]string) (*apiv1beta1.ServiceInstance, error)
	RetrieveInstance(string, string) (*apiv1beta1.ServiceInstance, error)
	RetrieveInstanceByBinding(*apiv1beta1.ServiceBinding) (*apiv1beta1.ServiceInstance, error)
	RetrieveInstances(string, string, string) (*apiv1beta1.ServiceInstanceList, error)
	RetrieveInstancesByPlan(*apiv1beta1.ClusterServicePlan) ([]apiv1beta1.ServiceInstance, error)
	TouchInstance(string, string, int) error
	WaitForInstance(string, string, time.Duration, *time.Duration) (*apiv1beta1.ServiceInstance, error)
	WaitForInstanceToNotExist(string, string, time.Duration, *time.Duration) (*apiv1beta1.ServiceInstance, error)

	RetrievePlans(RetrievePlanOptions) ([]Plan, error)
	RetrievePlanByName(string) (*apiv1beta1.ClusterServicePlan, error)
	RetrievePlanByID(string) (*apiv1beta1.ClusterServicePlan, error)
	RetrievePlanByClassAndPlanNames(string, string) (*apiv1beta1.ClusterServicePlan, error)

	RetrieveSecretByBinding(*apiv1beta1.ServiceBinding) (*apicorev1.Secret, error)

	ServerVersion() (*version.Info, error)
}

SvcatClient is an interface containing the variuos actions in the svcat pkg lib This interface is then faked with Counterfeiter for the cmd/svcat unit tests

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL