v2action

package
v6.23.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package v2action contains the business logic for the commands/v2 package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	CloudControllerClient CloudControllerClient
	UAAClient             UAAClient
	Config                Config
}

Actor handles all business logic for Cloud Controller v2 operations.

func NewActor

func NewActor(ccClient CloudControllerClient, uaaClient UAAClient, config Config) Actor

NewActor returns a new actor.

func (Actor) DeleteOrganization

func (actor Actor) DeleteOrganization(orgName string) (Warnings, error)

DeleteOrganization deletes the Organization associated with the provided GUID. Once the deletion request is sent, it polls the deletion job until it's finished.

func (Actor) DeleteRoute

func (actor Actor) DeleteRoute(routeGUID string) (Warnings, error)

DeleteRoute deletes the Route associated with the provided Route GUID.

func (Actor) GetApplicationByNameAndSpace

func (actor Actor) GetApplicationByNameAndSpace(name string, spaceGUID string) (Application, Warnings, error)

GetApplicationByNameAndSpace returns an application with matching name in the space.

func (Actor) GetDomain

func (actor Actor) GetDomain(domainGUID string) (Domain, Warnings, error)

GetDomain returns the shared or private domain associated with the provided Domain GUID.

func (Actor) GetOrganizationByName

func (actor Actor) GetOrganizationByName(orgName string) (Organization, Warnings, error)

GetOrganizationByName returns an Organization based off of the name given.

func (Actor) GetOrganizationSpaces

func (actor Actor) GetOrganizationSpaces(orgGUID string) ([]Space, Warnings, error)

GetOrganizationSpaces returns a list of spaces in the specified org

func (Actor) GetOrphanedRoutesBySpace

func (actor Actor) GetOrphanedRoutesBySpace(spaceGUID string) ([]Route, Warnings, error)

GetOrphanedRoutesBySpace returns a list of orphaned routes associated with the provided Space GUID.

func (Actor) GetPrivateDomain

func (actor Actor) GetPrivateDomain(domainGUID string) (Domain, Warnings, error)

GetPrivateDomain returns the private domain associated with the provided Domain GUID.

func (Actor) GetRouteApplications

func (actor Actor) GetRouteApplications(routeGUID string, query []ccv2.Query) ([]Application, Warnings, error)

GetRouteApplications returns a list of apps associated with the provided Route GUID

func (Actor) GetServiceBindingByApplicationAndServiceInstance

func (actor Actor) GetServiceBindingByApplicationAndServiceInstance(appGUID string, serviceInstanceGUID string) (ServiceBinding, Warnings, error)

GetServiceBindingByApplicationAndServiceInstance returns a service binding given an application GUID and and service instance GUID.

func (Actor) GetServiceInstanceByNameAndSpace

func (actor Actor) GetServiceInstanceByNameAndSpace(name string, spaceGUID string) (ServiceInstance, Warnings, error)

GetServiceInstanceByNameAndSpace returns a given instance by name and space GUID.

func (Actor) GetSharedDomain

func (actor Actor) GetSharedDomain(domainGUID string) (Domain, Warnings, error)

GetSharedDomain returns the shared domain associated with the provided Domain GUID.

func (Actor) GetSpaceByOrganizationAndName

func (actor Actor) GetSpaceByOrganizationAndName(orgGUID string, spaceName string) (Space, Warnings, error)

GetSpaceByOrganizationAndName returns an Space based on the org and name.

func (Actor) GetSpaceRoutes

func (actor Actor) GetSpaceRoutes(spaceGUID string, query []ccv2.Query) ([]Route, Warnings, error)

GetSpaceRoutes returns a list of routes associated with the provided Space GUID

func (Actor) GetSpaceServiceInstanceByName

func (actor Actor) GetSpaceServiceInstanceByName(spaceGUID string, name string) (ServiceInstance, Warnings, error)

TODO: Delete Me and use the other one

func (Actor) NewUser

func (actor Actor) NewUser(username string, password string, origin string) (User, Warnings, error)

NewUser creates a new user in UAA and registers it with cloud controller.

func (Actor) PollJob

func (actor Actor) PollJob(job ccv2.Job) (Warnings, error)

PollJob will keep polling the given job until the job has terminated, an error is encountered, or config.OverallPollingTimeout is reached. In the last case, a JobTimeoutError is returned.

func (Actor) UnbindServiceBySpace

func (actor Actor) UnbindServiceBySpace(appName string, serviceInstanceName string, spaceGUID string) (Warnings, error)

UnbindServiceBySpace deletes the service binding between an application and service instance for a given space.

type Application

type Application ccv2.Application

Application represents an application.

type ApplicationNotFoundError

type ApplicationNotFoundError struct {
	Name string
}

ApplicationNotFoundError is returned when a requested application is not found.

func (ApplicationNotFoundError) Error

func (e ApplicationNotFoundError) Error() string

type CloudControllerClient

type CloudControllerClient interface {
	DeleteOrganization(orgGUID string) (ccv2.Job, ccv2.Warnings, error)
	DeleteRoute(routeGUID string) (ccv2.Warnings, error)
	DeleteServiceBinding(serviceBindingGUID string) (ccv2.Warnings, error)
	GetApplications(queries []ccv2.Query) ([]ccv2.Application, ccv2.Warnings, error)
	GetJob(jobGUID string) (ccv2.Job, ccv2.Warnings, error)
	GetOrganizations(queries []ccv2.Query) ([]ccv2.Organization, ccv2.Warnings, error)
	GetPrivateDomain(domainGUID string) (ccv2.Domain, ccv2.Warnings, error)
	GetRouteApplications(routeGUID string, queries []ccv2.Query) ([]ccv2.Application, ccv2.Warnings, error)
	GetServiceBindings(queries []ccv2.Query) ([]ccv2.ServiceBinding, ccv2.Warnings, error)
	GetServiceInstances(queries []ccv2.Query) ([]ccv2.ServiceInstance, ccv2.Warnings, error)
	GetSharedDomain(domainGUID string) (ccv2.Domain, ccv2.Warnings, error)
	GetSpaceRoutes(spaceGUID string, queries []ccv2.Query) ([]ccv2.Route, ccv2.Warnings, error)
	GetSpaces(queries []ccv2.Query) ([]ccv2.Space, ccv2.Warnings, error)
	GetSpaceServiceInstances(spaceGUID string, includeUserProvidedServices bool, queries []ccv2.Query) ([]ccv2.ServiceInstance, ccv2.Warnings, error)
	NewUser(uaaUserID string) (ccv2.User, ccv2.Warnings, error)
}

CloudControllerClient is a Cloud Controller V2 client.

type Config

type Config interface {
	PollingInterval() time.Duration
	OverallPollingTimeout() time.Duration
}

type Domain

type Domain ccv2.Domain

Domain represents a CLI Domain.

type DomainNotFoundError

type DomainNotFoundError struct{}

DomainNotFoundError is an error wrapper that represents the case when the domain is not found.

func (DomainNotFoundError) Error

func (e DomainNotFoundError) Error() string

Error method to display the error message.

type JobFailedError

type JobFailedError struct {
	JobGUID string
	Message string
}

JobFailedError represents a failed Cloud Controller Job. It wraps the error returned back from the Cloud Controller.

func (JobFailedError) Error

func (e JobFailedError) Error() string

type JobTimeoutError

type JobTimeoutError struct {
	JobGUID string
	Timeout time.Duration
}

JobTimeoutError is returned from PollJob when the OverallPollingTimeout has been reached.

func (JobTimeoutError) Error

func (e JobTimeoutError) Error() string

type MultipleOrganizationsFoundError

type MultipleOrganizationsFoundError struct {
	Name  string
	GUIDs []string
}

MultipleOrganizationsFoundError represents the scenario when the cloud controller returns multiple organizations when filtering by name. This is a far out edge case and should not happen.

func (MultipleOrganizationsFoundError) Error

type MultipleSpacesFoundError

type MultipleSpacesFoundError struct {
	Name    string
	OrgGUID string
}

MultipleSpacesFoundError represents the scenario when the cloud controller returns multiple spaces when filtering by name. This is a far out edge case and should not happen.

func (MultipleSpacesFoundError) Error

func (e MultipleSpacesFoundError) Error() string

type Organization

type Organization ccv2.Organization

Organization represents a CLI Organization.

type OrganizationNotFoundError

type OrganizationNotFoundError struct {
	Name string
}

OrganizationNotFoundError represents the scenario when the organization searched for could not be found.

func (OrganizationNotFoundError) Error

type OrphanedRoutesNotFoundError

type OrphanedRoutesNotFoundError struct{}

OrphanedRoutesNotFoundError is an error wrapper that represents the case when no orphaned routes are found.

func (OrphanedRoutesNotFoundError) Error

Error method to display the error message.

type Route

type Route struct {
	GUID   string
	Host   string
	Domain string
	Path   string
	Port   int
}

Route represents a CLI Route.

func (Route) String

func (r Route) String() string

String formats the route in a human readable format.

type ServiceBinding

type ServiceBinding ccv2.ServiceBinding

ServiceBinding represents the link between a service instance and an application.

type ServiceBindingNotFoundError

type ServiceBindingNotFoundError struct {
	AppGUID             string
	ServiceInstanceGUID string
}

ServiceBindingNotFoundError is returned when a service binding cannot be found.

func (ServiceBindingNotFoundError) Error

type ServiceInstance

type ServiceInstance ccv2.ServiceInstance

ServiceInstance represents an instance of a service.

type ServiceInstanceNotFoundError

type ServiceInstanceNotFoundError struct {
	Name string
}

func (ServiceInstanceNotFoundError) Error

type Space

type Space ccv2.Space

Space represents a CLI Space

type SpaceNotFoundError

type SpaceNotFoundError struct {
	Name string
}

SpaceFoundError represents the scenario when the space searched for could not be found.

func (SpaceNotFoundError) Error

func (e SpaceNotFoundError) Error() string

type UAAClient

type UAAClient interface {
	NewUser(username string, password string, origin string) (uaa.User, error)
}

type User

type User ccv2.User

User represents a CLI user.

type Warnings

type Warnings []string

Warnings is a list of warnings returned back from the cloud controller

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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