services

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package services encapsulates all the functionality around Epinio services, catalog-based and custom

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatalogServiceList

func CatalogServiceList(ctx context.Context, cluster *kubernetes.Cluster, org string) (interfaces.ServiceList, error)

CatalogServiceList returns a ServiceList of all available catalog Services

func CatalogServiceLookup

func CatalogServiceLookup(ctx context.Context, cluster *kubernetes.Cluster, org, service string) (interfaces.Service, error)

CatalogServiceLookup finds the named service

func CreateCatalogService

func CreateCatalogService(ctx context.Context, cluster *kubernetes.Cluster, name, org, username, class, plan string, parameters string) (interfaces.Service, error)

CreateCatalogService creates a new catalog-based service from org, name, class, plan, and a string of parameter data (serialized json map).

func CreateCustomService

func CreateCustomService(ctx context.Context, kubeClient *kubernetes.Cluster, name, org, username string,
	data map[string]string) (interfaces.Service, error)

CreateCustomService creates a new custom service instance from org, name, and a map of parameters.

func CustomServiceList

func CustomServiceList(ctx context.Context, kubeClient *kubernetes.Cluster, org string) (interfaces.ServiceList, error)

CustomServiceList returns a ServiceList of all available custom Services

func CustomServiceLookup

func CustomServiceLookup(ctx context.Context, kubeClient *kubernetes.Cluster, org, service string) (interfaces.Service, error)

CustomServiceLookup finds a Custom Service instance by looking for the relevant Secret.

func List

func List(ctx context.Context, kubeClient *kubernetes.Cluster, org string) (interfaces.ServiceList, error)

List returns a ServiceList of all available Services

func Lookup

func Lookup(ctx context.Context, kubeClient *kubernetes.Cluster, org, service string) (interfaces.Service, error)

Lookup locates a Service by org and name

Types

type CatalogService

type CatalogService struct {
	InstanceName string
	OrgName      string
	Service      string
	Class        string
	Plan         string
	Username     string
	// contains filtered or unexported fields
}

CatalogService is a Service created using Service Catalog. Implements the Service interface.

func (*CatalogService) Delete

func (s *CatalogService) Delete(ctx context.Context) error

Delete (Service interface) destroys the service instance, i.e. the underlying kube service instance resource

func (*CatalogService) DeleteBinding

func (s *CatalogService) DeleteBinding(ctx context.Context, appName, org string) error

DeleteBinding (Service interface) deletes the ServiceBinding resource. The relevant secret will also be deleted automatically.

func (*CatalogService) Details

func (s *CatalogService) Details(_ context.Context) (map[string]string, error)

Details (Service interface) returns the service configuration, i.e. class and plan.

func (*CatalogService) GetBinding

func (s *CatalogService) GetBinding(ctx context.Context, appName, username string) (*corev1.Secret, error)

GetBinding (Service interface) returns an application-specific secret for the service to be bound to that application.

func (*CatalogService) Name

func (s *CatalogService) Name() string

Name (Service interface) returns the service's name

func (*CatalogService) Org

func (s *CatalogService) Org() string

Org (Service interface) returns the service's organization

func (*CatalogService) Status

func (s *CatalogService) Status(ctx context.Context) (string, error)

Status (Service interface) returns the service provision status. It queries the underlying service instance resource for this

func (*CatalogService) User added in v0.0.24

func (s *CatalogService) User() string

User (Service interface) returns the service's username

func (*CatalogService) WaitForProvision

func (s *CatalogService) WaitForProvision(ctx context.Context) error

WaitForProvision (Service interface) waits for the service instance to be provisioned.

type CustomService

type CustomService struct {
	SecretName string
	OrgName    string
	Service    string
	Username   string
	// contains filtered or unexported fields
}

CustomService is a user defined service instance, also called a custom service. It implements the Service interface.

func (*CustomService) Delete

func (s *CustomService) Delete(ctx context.Context) error

Delete (Service interface) destroys the service instance, i.e. its underlying secret holding the instance's parameters

func (*CustomService) DeleteBinding

func (s *CustomService) DeleteBinding(_ context.Context, appName, org string) error

DeleteBinding (Service interface) does nothing in the case of custom service instances because they are represented by just a secret which may be re-used later.

func (*CustomService) Details

func (s *CustomService) Details(ctx context.Context) (map[string]string, error)

Details (Service interface) returns the service instance's configuration. I.e. the parameter data.

func (*CustomService) GetBinding

func (s *CustomService) GetBinding(ctx context.Context, appName string, _ string) (*corev1.Secret, error)

GetBinding (Service interface) returns the secret representing the instance's binding to the application. This is actually the instance's secret itself, independent of the application.

func (*CustomService) Name

func (s *CustomService) Name() string

Name (Service interface) returns the service instance's name

func (*CustomService) Org

func (s *CustomService) Org() string

Org (Service interface) returns the service instance's organization

func (*CustomService) Status

func (s *CustomService) Status(_ context.Context) (string, error)

Status (Service interface) returns the instance's provision status. As no actual provisioning had to be done it is always fully provisioned.

func (*CustomService) User added in v0.0.24

func (s *CustomService) User() string

User (Service interface) returns the service's username

func (*CustomService) WaitForProvision

func (s *CustomService) WaitForProvision(_ context.Context) error

WaitForProvision (Service interface) waits for the service instance to be provisioned. As no actual provisioning had to be done no waiting is required either.

type ServiceClass

type ServiceClass struct {
	Hash        string
	Name        string
	Broker      string
	Description string
	// contains filtered or unexported fields
}

ServiceClass represents a service class managed by Service catalog

func ClassLookup

func ClassLookup(ctx context.Context, cluster *kubernetes.Cluster, serviceClassName string) (*ServiceClass, error)

ClassLookup finds the named service class

func (*ServiceClass) ListPlans

func (sc *ServiceClass) ListPlans(ctx context.Context) (ServicePlanList, error)

ListPlans returns a ServicePlanList of all available catalog service plans, for the named class

func (*ServiceClass) LookupPlan added in v0.0.11

func (sc *ServiceClass) LookupPlan(ctx context.Context, plan string) (*ServicePlan, error)

LookupPlan returns the named ServicePlan, for the specified class

type ServiceClassList

type ServiceClassList []ServiceClass

func ListClasses

func ListClasses(ctx context.Context, cluster *kubernetes.Cluster) (ServiceClassList, error)

ListClasses returns a ServiceClassList of all available catalog service classes

func (ServiceClassList) Len added in v0.0.13

func (scl ServiceClassList) Len() int

Len (Sort interface) returns the length of the ServiceClassList

func (ServiceClassList) Less added in v0.0.13

func (scl ServiceClassList) Less(i, j int) bool

Less (Sort interface) compares the contents of the specified indices in the ServiceClassList and returns true if the condition holds, and else false.

func (ServiceClassList) Swap added in v0.0.13

func (scl ServiceClassList) Swap(i, j int)

Swap (Sort interface) exchanges the contents of specified indices in the ServiceClassList

type ServicePlan

type ServicePlan struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Free        bool   `json:"free,omitempty"`
}

ServicePlan represents a service plan managed by Service catalog

type ServicePlanList

type ServicePlanList []ServicePlan

ServicePlanList represents a collection of service plans

func (ServicePlanList) Len added in v0.0.13

func (spl ServicePlanList) Len() int

Len (Sort interface) returns the length of the ServicePlanList

func (ServicePlanList) Less added in v0.0.13

func (spl ServicePlanList) Less(i, j int) bool

Less (Sort interface) compares the contents of the specified indices in the ServicePlanList and returns true if the condition holds, and else false.

func (ServicePlanList) Swap added in v0.0.13

func (spl ServicePlanList) Swap(i, j int)

Swap (Sort interface) exchanges the contents of specified indices in the ServicePlanList

Jump to

Keyboard shortcuts

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