v3action

package
v6.32.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package v3action contains the business logic for the commands/v3 package

Index

Constants

View Source
const (
	DefaultFolderPermissions      = 0755
	DefaultArchiveFilePermissions = 0744
)
View Source
const StagingLog = "STG"

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	CloudControllerClient CloudControllerClient
	Config                Config
}

Actor represents a V3 actor.

func NewActor

func NewActor(client CloudControllerClient, config Config) *Actor

NewActor returns a new V3 actor.

func (Actor) AssignIsolationSegmentToSpaceByNameAndSpace

func (actor Actor) AssignIsolationSegmentToSpaceByNameAndSpace(isolationSegmentName string, spaceGUID string) (Warnings, error)

func (Actor) CloudControllerAPIVersion

func (actor Actor) CloudControllerAPIVersion() string

CloudControllerAPIVersion returns back the Cloud Controller API version.

func (Actor) CreateApplicationInSpace

func (actor Actor) CreateApplicationInSpace(app Application, spaceGUID string) (Application, Warnings, error)

CreateApplicationInSpace creates and returns the application with the given name in the given space.

func (Actor) CreateIsolationSegmentByName

func (actor Actor) CreateIsolationSegmentByName(isolationSegment IsolationSegment) (Warnings, error)

CreateIsolationSegmentByName creates a given isolation segment.

func (Actor) CreatePackageByApplicationNameAndSpace

func (actor Actor) CreatePackageByApplicationNameAndSpace(appName string, spaceGUID string, bitsPath string, dockerImageCredentials DockerImageCredentials) (Package, Warnings, error)

func (Actor) DeleteApplicationByNameAndSpace

func (actor Actor) DeleteApplicationByNameAndSpace(name string, spaceGUID string) (Warnings, error)

func (Actor) DeleteInstanceByApplicationNameSpaceProcessTypeAndIndex

func (actor Actor) DeleteInstanceByApplicationNameSpaceProcessTypeAndIndex(appName string, spaceGUID string, processType string, instanceIndex int) (Warnings, error)

func (Actor) DeleteIsolationSegmentByName

func (actor Actor) DeleteIsolationSegmentByName(name string) (Warnings, error)

DeleteIsolationSegmentByName deletes the given isolation segment.

func (Actor) EntitleIsolationSegmentToOrganizationByName

func (actor Actor) EntitleIsolationSegmentToOrganizationByName(isolationSegmentName string, orgName string) (Warnings, error)

EntitleIsolationSegmentToOrganizationByName entitles the given organization to use the specified isolation segment

func (Actor) GetApplicationByNameAndSpace

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

GetApplicationByNameAndSpace returns the application with the given name in the given space.

func (Actor) GetApplicationDroplets

func (actor Actor) GetApplicationDroplets(appName string, spaceGUID string) ([]Droplet, Warnings, error)

GetApplicationDroplets returns the list of droplets that belong to applicaiton.

func (*Actor) GetApplicationPackages

func (actor *Actor) GetApplicationPackages(appName string, spaceGUID string) ([]Package, Warnings, error)

GetApplicationPackages returns a list of package of an app.

func (Actor) GetApplicationProcessHealthChecksByNameAndSpace

func (actor Actor) GetApplicationProcessHealthChecksByNameAndSpace(appName string, spaceGUID string) ([]ProcessHealthCheck, Warnings, error)

func (Actor) GetApplicationSummaryByNameAndSpace

func (actor Actor) GetApplicationSummaryByNameAndSpace(appName string,
	spaceGUID string) (ApplicationSummary, Warnings, error)

GetApplicationSummaryByNameAndSpace returns an application with process and instance stats.

func (Actor) GetApplicationTasks

func (actor Actor) GetApplicationTasks(appGUID string, sortOrder SortOrder) ([]Task, Warnings, error)

GetApplicationTasks returns a list of tasks associated with the provided appplication GUID.

func (Actor) GetApplicationsBySpace

func (actor Actor) GetApplicationsBySpace(spaceGUID string) ([]Application, Warnings, error)

GetApplicationsBySpace returns all applications in a space.

func (Actor) GetApplicationsWithProcessesBySpace

func (actor Actor) GetApplicationsWithProcessesBySpace(spaceGUID string) ([]ApplicationWithProcessSummary, Warnings, error)

func (Actor) GetEffectiveIsolationSegmentBySpace

func (actor Actor) GetEffectiveIsolationSegmentBySpace(spaceGUID string, orgDefaultIsolationSegmentGUID string) (IsolationSegment, Warnings, error)

GetEffectiveIsolationSegmentBySpace returns the space's effective isolation segment.

If the space has its own isolation segment, that will be returned.

If the space does not have one, the organization's default isolation segment (GUID passed in) will be returned.

If the space does not have one and the passed in organization default isolation segment GUID is empty, a NoRelationshipError will be returned.

func (*Actor) GetEnvironmentVariablesByApplicationNameAndSpace

func (actor *Actor) GetEnvironmentVariablesByApplicationNameAndSpace(appName string, spaceGUID string) (EnvironmentVariableGroups, Warnings, error)

GetEnvironmentVariablesByApplicationNameAndSpace returns the environment variables for an application.

func (Actor) GetIsolationSegmentByName

func (actor Actor) GetIsolationSegmentByName(name string) (IsolationSegment, Warnings, error)

GetIsolationSegmentByName returns the requested isolation segment.

func (Actor) GetIsolationSegmentSummaries

func (actor Actor) GetIsolationSegmentSummaries() ([]IsolationSegmentSummary, Warnings, error)

GetIsolationSegmentSummaries returns all isolation segments and their entitled orgs

func (Actor) GetIsolationSegmentsByOrganization

func (actor Actor) GetIsolationSegmentsByOrganization(orgGUID string) ([]IsolationSegment, Warnings, error)

func (Actor) GetOrganizationByName

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

GetOrganizationByName returns the organization with the given name.

func (Actor) GetStreamingLogs

func (Actor) GetStreamingLogs(appGUID string, client NOAAClient) (<-chan *LogMessage, <-chan error)

func (Actor) GetStreamingLogsForApplicationByNameAndSpace

func (actor Actor) GetStreamingLogsForApplicationByNameAndSpace(appName string, spaceGUID string, client NOAAClient) (<-chan *LogMessage, <-chan error, Warnings, error)

func (Actor) GetTaskBySequenceIDAndApplication

func (actor Actor) GetTaskBySequenceIDAndApplication(sequenceID int, appGUID string) (Task, Warnings, error)

func (Actor) PollStart

func (actor Actor) PollStart(appGUID string, warningsChannel chan<- Warnings) error

func (Actor) ResetOrganizationDefaultIsolationSegment

func (actor Actor) ResetOrganizationDefaultIsolationSegment(orgGUID string) (Warnings, error)

ResetOrganizationDefaultIsolationSegment resets the default isolation segment fon an organization.

func (Actor) ResetSpaceIsolationSegment

func (actor Actor) ResetSpaceIsolationSegment(orgGUID string, spaceGUID string) (string, Warnings, error)

ResetSpaceIsolationSegment disassociates a space from an isolation segment.

If the space's organization has a default isolation segment, return its name. Otherwise return the empty string.

func (Actor) RevokeIsolationSegmentFromOrganizationByName

func (actor Actor) RevokeIsolationSegmentFromOrganizationByName(isolationSegmentName string, orgName string) (Warnings, error)

func (Actor) RunTask

func (actor Actor) RunTask(appGUID string, task Task) (Task, Warnings, error)

RunTask runs the provided command in the application environment associated with the provided application GUID.

func (Actor) ScaleProcessByApplication

func (actor Actor) ScaleProcessByApplication(appGUID string, process Process) (Warnings, error)

func (Actor) SetApplicationDroplet

func (actor Actor) SetApplicationDroplet(appName string, spaceGUID string, dropletGUID string) (Warnings, error)

SetApplicationDroplet sets the droplet for an application.

func (Actor) SetApplicationProcessHealthCheckTypeByNameAndSpace

func (actor Actor) SetApplicationProcessHealthCheckTypeByNameAndSpace(appName string, spaceGUID string, healthCheckType string, httpEndpoint string, processType string) (Application, Warnings, error)

func (*Actor) SetEnvironmentVariableByApplicationNameAndSpace

func (actor *Actor) SetEnvironmentVariableByApplicationNameAndSpace(appName string, spaceGUID string, envPair EnvironmentVariablePair) (Warnings, error)

SetEnvironmentVariableByApplicationNameAndSpace adds an EnvironmentVariablePair to an application. It must be restarted for changes to take effect.

func (Actor) SetOrganizationDefaultIsolationSegment

func (actor Actor) SetOrganizationDefaultIsolationSegment(orgGUID string, isoSegGUID string) (Warnings, error)

SetOrganizationDefaultIsolationSegment sets a default isolation segment on an organization.

func (Actor) StagePackage

func (actor Actor) StagePackage(packageGUID string, appName string) (<-chan Droplet, <-chan Warnings, <-chan error)

func (Actor) StartApplication

func (actor Actor) StartApplication(appGUID string) (Application, Warnings, error)

StartApplication starts an application.

func (Actor) StopApplication

func (actor Actor) StopApplication(appGUID string) (Warnings, error)

StopApplication stops an application.

func (Actor) TerminateTask

func (actor Actor) TerminateTask(taskGUID string) (Task, Warnings, error)

func (*Actor) UnsetEnvironmentVariableByApplicationNameAndSpace

func (actor *Actor) UnsetEnvironmentVariableByApplicationNameAndSpace(appName string, spaceGUID string, environmentVariableName string) (Warnings, error)

UnsetEnvironmentVariableByApplicationNameAndSpace removes an enviornment variable from an application. It must be restarted for changes to take effect.

func (Actor) UpdateApplication

func (actor Actor) UpdateApplication(app Application) (Application, Warnings, error)

UpdateApplication updates the buildpacks on an application

type AppLifecycle

type AppLifecycle struct {
	Type AppLifecycleType
	Data AppLifecycleData
}

type AppLifecycleData

type AppLifecycleData ccv3.AppLifecycleData

type AppLifecycleType

type AppLifecycleType ccv3.AppLifecycleType

type Application

type Application struct {
	Name      string
	GUID      string
	State     string
	Lifecycle AppLifecycle
}

Application represents a V3 actor application.

func (Application) Started

func (app Application) Started() bool

type ApplicationAlreadyExistsError

type ApplicationAlreadyExistsError struct {
	Name string
}

ApplicationAlreadyExistsError represents the error that occurs when the application already exists.

func (ApplicationAlreadyExistsError) Error

type ApplicationNotFoundError

type ApplicationNotFoundError struct {
	Name string
}

ApplicationNotFoundError represents the error that occurs when the application is not found.

func (ApplicationNotFoundError) Error

func (e ApplicationNotFoundError) Error() string

type ApplicationSummary

type ApplicationSummary struct {
	Application
	ProcessSummaries ProcessSummaries
	CurrentDroplet   Droplet
}

ApplicationSummary represents an application with its processes and droplet.

type ApplicationWithProcessSummary

type ApplicationWithProcessSummary struct {
	Application
	ProcessSummaries ProcessSummaries
}

type AssignDropletError

type AssignDropletError struct {
	Message string
}

AssignDropletError is returned when assigning the current droplet of an app fails

func (AssignDropletError) Error

func (a AssignDropletError) Error() string

type Buildpack

type Buildpack ccv3.DropletBuildpack

type CloudControllerClient

type CloudControllerClient interface {
	AssignSpaceToIsolationSegment(spaceGUID string, isolationSegmentGUID string) (ccv3.Relationship, ccv3.Warnings, error)
	CloudControllerAPIVersion() string
	CreateApplication(app ccv3.Application) (ccv3.Application, ccv3.Warnings, error)
	CreateApplicationProcessScale(appGUID string, process ccv3.Process) (ccv3.Warnings, error)
	CreateApplicationTask(appGUID string, task ccv3.Task) (ccv3.Task, ccv3.Warnings, error)
	CreateBuild(build ccv3.Build) (ccv3.Build, ccv3.Warnings, error)
	CreateIsolationSegment(isolationSegment ccv3.IsolationSegment) (ccv3.IsolationSegment, ccv3.Warnings, error)
	CreatePackage(pkg ccv3.Package) (ccv3.Package, ccv3.Warnings, error)
	DeleteApplication(guid string) (string, ccv3.Warnings, error)
	DeleteApplicationProcessInstance(appGUID string, processType string, instanceIndex int) (ccv3.Warnings, error)
	DeleteIsolationSegment(guid string) (ccv3.Warnings, error)
	EntitleIsolationSegmentToOrganizations(isoGUID string, orgGUIDs []string) (ccv3.RelationshipList, ccv3.Warnings, error)
	GetApplicationDroplets(appGUID string, query url.Values) ([]ccv3.Droplet, ccv3.Warnings, error)
	GetApplicationEnvironmentVariables(appGUID string) (ccv3.EnvironmentVariableGroups, ccv3.Warnings, error)
	GetApplicationProcessByType(appGUID string, processType string) (ccv3.Process, ccv3.Warnings, error)
	GetApplicationProcesses(appGUID string) ([]ccv3.Process, ccv3.Warnings, error)
	GetApplicationTasks(appGUID string, query url.Values) ([]ccv3.Task, ccv3.Warnings, error)
	GetApplications(query url.Values) ([]ccv3.Application, ccv3.Warnings, error)
	GetBuild(guid string) (ccv3.Build, ccv3.Warnings, error)
	GetDroplet(guid string) (ccv3.Droplet, ccv3.Warnings, error)
	GetIsolationSegment(guid string) (ccv3.IsolationSegment, ccv3.Warnings, error)
	GetIsolationSegmentOrganizationsByIsolationSegment(isolationSegmentGUID string) ([]ccv3.Organization, ccv3.Warnings, error)
	GetIsolationSegments(query url.Values) ([]ccv3.IsolationSegment, ccv3.Warnings, error)
	GetOrganizationDefaultIsolationSegment(orgGUID string) (ccv3.Relationship, ccv3.Warnings, error)
	GetOrganizations(query url.Values) ([]ccv3.Organization, ccv3.Warnings, error)
	GetPackages(query url.Values) ([]ccv3.Package, ccv3.Warnings, error)
	GetPackage(guid string) (ccv3.Package, ccv3.Warnings, error)
	GetProcessInstances(processGUID string) ([]ccv3.Instance, ccv3.Warnings, error)
	GetSpaceIsolationSegment(spaceGUID string) (ccv3.Relationship, ccv3.Warnings, error)
	PatchApplicationProcessHealthCheck(processGUID string, processHealthCheckType string, processHealthCheckEndpoint string) (ccv3.Warnings, error)
	PatchOrganizationDefaultIsolationSegment(orgGUID string, isolationSegmentGUID string) (ccv3.Warnings, error)
	PollJob(jobURL string) (ccv3.Warnings, error)
	RevokeIsolationSegmentFromOrganization(isolationSegmentGUID string, organizationGUID string) (ccv3.Warnings, error)
	SetApplicationDroplet(appGUID string, dropletGUID string) (ccv3.Relationship, ccv3.Warnings, error)
	StartApplication(appGUID string) (ccv3.Application, ccv3.Warnings, error)
	StopApplication(appGUID string) (ccv3.Warnings, error)
	UpdateApplication(app ccv3.Application) (ccv3.Application, ccv3.Warnings, error)
	PatchApplicationUserProvidedEnvironmentVariables(appGUID string, envVars ccv3.EnvironmentVariables) (ccv3.EnvironmentVariables, ccv3.Warnings, error)
	UpdateTask(taskGUID string) (ccv3.Task, ccv3.Warnings, error)
	UploadPackage(pkg ccv3.Package, zipFilepath string) (ccv3.Package, ccv3.Warnings, error)
}

CloudControllerClient is the interface to the cloud controller V3 API.

type Config

type Config interface {
	PollingInterval() time.Duration
	StartupTimeout() time.Duration
	StagingTimeout() time.Duration
}

type DockerImageCredentials

type DockerImageCredentials struct {
	Path     string
	Username string
	Password string
}

type Droplet

type Droplet struct {
	GUID       string
	State      DropletState
	CreatedAt  string
	Stack      string
	Image      string
	Buildpacks []Buildpack
}

Droplet represents a Cloud Controller droplet.

type DropletState

type DropletState string
const (
	DropletStateStaged  DropletState = "STAGED"
	DropletStateFailed  DropletState = "FAILED"
	DropletStateCopying DropletState = "COPYING"
	DropletStateExpired DropletState = "EXPIRED"
)

type EmptyDirectoryError

type EmptyDirectoryError struct {
	Path string
}

func (EmptyDirectoryError) Error

func (e EmptyDirectoryError) Error() string

type EnvironmentVariableGroups

type EnvironmentVariableGroups ccv3.EnvironmentVariableGroups

EnvironmentVariableGroups represents all environment variables for application

type EnvironmentVariableNotSetError

type EnvironmentVariableNotSetError struct {
	EnvironmentVariableName string
}

EnvironmentVariableNotSetError is returned when trying to unset env variable that was not previously set.

func (EnvironmentVariableNotSetError) Error

type EnvironmentVariablePair

type EnvironmentVariablePair struct {
	Key   string
	Value string
}

EnvironmentVariablePair represents an environment variable and its value on an application

type HTTPHealthCheckInvalidError

type HTTPHealthCheckInvalidError struct {
}

HTTPHealthCheckInvalidError is returned when an HTTP endpoint is used with a health check type that is not HTTP.

func (HTTPHealthCheckInvalidError) Error

type Instance

type Instance ccv3.Instance

Instance represents a V3 actor instance.

func (*Instance) StartTime

func (instance *Instance) StartTime() time.Time

StartTime returns the time that the instance started.

type IsolationSegment

type IsolationSegment ccv3.IsolationSegment

IsolationSegment represents a V3 actor IsolationSegment.

type IsolationSegmentAlreadyExistsError

type IsolationSegmentAlreadyExistsError struct {
	Name string
}

IsolationSegmentAlreadyExistsError gets returned when an isolation segment already exists.

func (IsolationSegmentAlreadyExistsError) Error

type IsolationSegmentNotFoundError

type IsolationSegmentNotFoundError struct {
	Name string
}

IsolationSegmentNotFoundError represents the error that occurs when the isolation segment is not found.

func (IsolationSegmentNotFoundError) Error

type IsolationSegmentSummary

type IsolationSegmentSummary struct {
	Name         string
	EntitledOrgs []string
}

type LogMessage

type LogMessage struct {
	// contains filtered or unexported fields
}

func NewLogMessage

func NewLogMessage(message string, messageType int, timestamp time.Time, sourceType string, sourceInstance string) *LogMessage

func (LogMessage) Message

func (log LogMessage) Message() string

func (LogMessage) SourceInstance

func (log LogMessage) SourceInstance() string

func (LogMessage) SourceType

func (log LogMessage) SourceType() string

func (LogMessage) Staging

func (log LogMessage) Staging() bool

func (LogMessage) Timestamp

func (log LogMessage) Timestamp() time.Time

func (LogMessage) Type

func (log LogMessage) Type() string

type NOAAClient

type NOAAClient interface {
	Close() error
	RecentLogs(appGuid string, authToken string) ([]*events.LogMessage, error)
	TailingLogs(appGuid, authToken string) (<-chan *events.LogMessage, <-chan error)
}

NOAAClient is a client for getting logs.

type NOAATimeoutError

type NOAATimeoutError struct{}

func (NOAATimeoutError) Error

func (NOAATimeoutError) Error() string

type NoRelationshipError

type NoRelationshipError struct {
}

func (NoRelationshipError) Error

func (e NoRelationshipError) Error() string

type Organization

type Organization ccv3.Organization

Organization represents a V3 actor organization.

type OrganizationNotFoundError

type OrganizationNotFoundError struct {
	Name string
}

OrganizationNotFoundError represents the error that occurs when the organization is not found.

func (OrganizationNotFoundError) Error

type Package

type Package ccv3.Package

type PackageProcessingExpiredError

type PackageProcessingExpiredError struct{}

func (PackageProcessingExpiredError) Error

type PackageProcessingFailedError

type PackageProcessingFailedError struct{}

func (PackageProcessingFailedError) Error

type Process

type Process ccv3.Process

Process represents a V3 actor process.

type ProcessHealthCheck

type ProcessHealthCheck struct {
	ProcessType     string
	HealthCheckType string
	Endpoint        string
}

type ProcessHealthChecks

type ProcessHealthChecks []ProcessHealthCheck

func (ProcessHealthChecks) Sort

func (phs ProcessHealthChecks) Sort()

type ProcessInstanceNotFoundError

type ProcessInstanceNotFoundError struct {
	ProcessType   string
	InstanceIndex int
}

ProcessInstanceNotFoundError is returned when the proccess type or process instance cannot be found

func (ProcessInstanceNotFoundError) Error

type ProcessNotFoundError

type ProcessNotFoundError struct {
	ProcessType string
}

ProcessNotFoundError is returned when the proccess type cannot be found

func (ProcessNotFoundError) Error

func (e ProcessNotFoundError) Error() string

type ProcessSummaries

type ProcessSummaries []ProcessSummary

func (ProcessSummaries) Sort

func (ps ProcessSummaries) Sort()

func (ProcessSummaries) String

func (ps ProcessSummaries) String() string

type ProcessSummary

type ProcessSummary struct {
	Process

	InstanceDetails []Instance
}

ProcessSummary represents a process with instance details.

func (ProcessSummary) HealthyInstanceCount

func (p ProcessSummary) HealthyInstanceCount() int

func (ProcessSummary) TotalInstanceCount

func (p ProcessSummary) TotalInstanceCount() int

type SortOrder

type SortOrder string

This is used for sorting.

const (
	Ascending  SortOrder = "Ascending"
	Descending SortOrder = "Descending"
)

type StagingTimeoutError

type StagingTimeoutError struct {
	AppName string
	Timeout time.Duration
}

func (StagingTimeoutError) Error

func (StagingTimeoutError) Error() string

type StartupTimeoutError

type StartupTimeoutError struct {
}

StartupTimeoutError is returned when startup timeout is reached waiting for an application to start.

func (StartupTimeoutError) Error

func (e StartupTimeoutError) Error() string

type Task

type Task ccv3.Task

Task represents a V3 actor Task.

type TaskNotFoundError

type TaskNotFoundError struct {
	SequenceID int
}

TaskNotFoundError is returned when no tasks matching the filters are found.

func (TaskNotFoundError) Error

func (e TaskNotFoundError) Error() string

type TaskWorkersUnavailableError

type TaskWorkersUnavailableError struct {
	Message string
}

TaskWorkersUnavailableError is returned when there are no workers to run a given task.

func (TaskWorkersUnavailableError) Error

type Warnings

type Warnings []string

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

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