ccv2

package
v6.34.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package ccv2 represents a Cloud Controller V2 client.

These sets of packages are still under development/pre-pre-pre...alpha. Use at your own risk! Functionality and design may change without warning.

It is currently designed to support Cloud Controller API 2.23.0. However, it may include features and endpoints of later API versions.

For more information on the Cloud Controller API see https://apidocs.cloudfoundry.org/

Method Naming Conventions

The client takes a '<Action Name><Top Level Endpoint><Return Value>' approach to method names. If the <Top Level Endpoint> and <Return Value> are similar, they do not need to be repeated. If a GUID is required for the <Top Level Endpoint>, the pluralization is removed from said endpoint in the method name.

For Example:

Method Name: GetApplication
Endpoint: /v2/applications/:guid
Action Name: Get
Top Level Endpoint: applications
Return Value: Application

Method Name: GetServiceInstances
Endpoint: /v2/service_instances
Action Name: Get
Top Level Endpoint: service_instances
Return Value: []ServiceInstance

Method Name: GetSpaceServiceInstances
Endpoint: /v2/spaces/:guid/service_instances
Action Name: Get
Top Level Endpoint: spaces
Return Value: []ServiceInstance

Use the following table to determine which HTTP Command equates to which Action Name:

HTTP Command -> Action Name
POST -> Create
GET -> Get
PUT -> Update
DELETE -> Delete
PATCH -> Patch

Method Locations

Methods exist in the same file as their return type, regardless of which endpoint they use.

Error Handling

All error handling that requires parsing the error_code/code returned back from the Cloud Controller should be placed in the errorWrapper. Everything else can be handled in the individual operations. All parsed cloud controller errors should exist in errors.go, all generic HTTP errors should exist in the cloudcontroller's errors.go. Errors related to the individaul operation should exist at the top of that operation's file.

No inline-relations-depth And summary Endpoints

This package will not use ever use 'inline-relations-depth' or the '/summary' endpoints for any operations. These requests can be extremely taxing on the Cloud Controller and are avoided at all costs. Additionally, the objects returned back from these requests can become extremely inconsistant across versions and are problematic to deal with in general.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatQueryParameters

func FormatQueryParameters(queries []QQuery) url.Values

FormatQueryParameters converts a Query object into a collection that cloudcontroller.Request can accept.

Types

type APIInformation

type APIInformation struct {
	APIVersion                   string `json:"api_version"`
	AuthorizationEndpoint        string `json:"authorization_endpoint"`
	DopplerEndpoint              string `json:"doppler_logging_endpoint"`
	MinCLIVersion                string `json:"min_cli_version"`
	MinimumRecommendedCLIVersion string `json:"min_recommended_cli_version"`
	Name                         string `json:"name"`
	RoutingEndpoint              string `json:"routing_endpoint"`
	TokenEndpoint                string `json:"token_endpoint"`
}

APIInformation represents the information returned back from /v2/info

type Application

type Application struct {
	// Buildpack is the buildpack set by the user.
	Buildpack types.FilteredString

	// Command is the user specified start command.
	Command types.FilteredString

	// DetectedBuildpack is the buildpack automatically detected.
	DetectedBuildpack types.FilteredString

	// DetectedStartCommand is the command used to start the application.
	DetectedStartCommand types.FilteredString

	// DiskQuota is the disk given to each instance, in megabytes.
	DiskQuota types.NullByteSizeInMb

	// DockerCredentials is the authentication information for the provided
	// DockerImage.
	DockerCredentials DockerCredentials

	// DockerImage is the docker image location.
	DockerImage string

	// EnvironmentVariables are the environment variables passed to the app.
	EnvironmentVariables map[string]string

	// GUID is the unique application identifier.
	GUID string

	// HealthCheckTimeout is the number of seconds for health checking of an
	// staged app when starting up.
	HealthCheckTimeout int

	// HealthCheckType is the type of health check that will be done to the app.
	HealthCheckType constant.ApplicationHealthCheckType

	// HealthCheckHTTPEndpoint is the url of the http health check endpoint.
	HealthCheckHTTPEndpoint string

	// Instances is the total number of app instances.
	Instances types.NullInt

	// Memory is the memory given to each instance, in megabytes.
	Memory types.NullByteSizeInMb

	// Name is the name given to the application.
	Name string

	// PackageState represents the staging state of the application bits.
	PackageState ApplicationPackageState

	// PackageUpdatedAt is the last time the app bits were updated. In RFC3339.
	PackageUpdatedAt time.Time

	// SpaceGUID is the GUID of the app's space.
	SpaceGUID string

	// StackGUID is the GUID for the Stack the application is running on.
	StackGUID string

	// StagingFailedDescription is the verbose description of why the package
	// failed to stage.
	StagingFailedDescription string

	// StagingFailedReason is the reason why the package failed to stage.
	StagingFailedReason string

	// State is the desired state of the application.
	State ApplicationState
}

Application represents a Cloud Controller Application.

func (Application) MarshalJSON

func (application Application) MarshalJSON() ([]byte, error)

MarshalJSON converts an application into a Cloud Controller Application.

func (*Application) UnmarshalJSON

func (application *Application) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Application response.

type ApplicationInstance

type ApplicationInstance struct {
	// Details are arbitrary information about the instance.
	Details string

	// ID is the instance ID.
	ID int

	// Since is the Unix time stamp that represents the time the instance was
	// created.
	Since float64

	// State is the instance's state.
	State ApplicationInstanceState
}

ApplicationInstance represents a Cloud Controller Application Instance.

func (*ApplicationInstance) UnmarshalJSON

func (instance *ApplicationInstance) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller application instance response.

type ApplicationInstanceState

type ApplicationInstanceState string

ApplicationInstanceState reflects the state of the individual app instance.

const (
	ApplicationInstanceCrashed  ApplicationInstanceState = "CRASHED"
	ApplicationInstanceDown     ApplicationInstanceState = "DOWN"
	ApplicationInstanceFlapping ApplicationInstanceState = "FLAPPING"
	ApplicationInstanceRunning  ApplicationInstanceState = "RUNNING"
	ApplicationInstanceStarting ApplicationInstanceState = "STARTING"
	ApplicationInstanceUnknown  ApplicationInstanceState = "UNKNOWN"
)

type ApplicationInstanceStatus

type ApplicationInstanceStatus struct {
	// CPU is the instance's CPU utilization percentage.
	CPU float64

	// Disk is the instance's disk usage in bytes.
	Disk int

	// DiskQuota is the instance's allowed disk usage in bytes.
	DiskQuota int

	// ID is the instance ID.
	ID int

	// IsolationSegment that the app is currently running on.
	IsolationSegment string

	// Memory is the instance's memory usage in bytes.
	Memory int

	// MemoryQuota is the instance's allowed memory usage in bytes.
	MemoryQuota int

	// State is the instance's state.
	State ApplicationInstanceState

	// Uptime is the number of seconds the instance has been running.
	Uptime int
}

ApplicationInstanceStatus represents a Cloud Controller Application Instance.

func (*ApplicationInstanceStatus) UnmarshalJSON

func (instance *ApplicationInstanceStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller application instance response.

type ApplicationPackageState

type ApplicationPackageState string

ApplicationPackageState is the staging state of application bits.

const (
	ApplicationPackageStaged  ApplicationPackageState = "STAGED"
	ApplicationPackagePending ApplicationPackageState = "PENDING"
	ApplicationPackageFailed  ApplicationPackageState = "FAILED"
	ApplicationPackageUnknown ApplicationPackageState = "UNKNOWN"
)

type ApplicationState

type ApplicationState string

ApplicationState is the running state of an application.

const (
	ApplicationStarted ApplicationState = "STARTED"
	ApplicationStopped ApplicationState = "STOPPED"
)

type Client

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

Client is a client that can be used to talk to a Cloud Controller's V2 Endpoints.

func NewClient

func NewClient(config Config) *Client

NewClient returns a new Cloud Controller Client.

func (*Client) API

func (client *Client) API() string

API returns the Cloud Controller API URL for the targeted Cloud Controller.

func (*Client) APIVersion

func (client *Client) APIVersion() string

APIVersion returns Cloud Controller API Version for the targeted Cloud Controller.

func (*Client) AssociateSpaceWithRunningSecurityGroup

func (client *Client) AssociateSpaceWithRunningSecurityGroup(securityGroupGUID string, spaceGUID string) (Warnings, error)

func (*Client) AssociateSpaceWithStagingSecurityGroup

func (client *Client) AssociateSpaceWithStagingSecurityGroup(securityGroupGUID string, spaceGUID string) (Warnings, error)

func (*Client) AuthorizationEndpoint

func (client *Client) AuthorizationEndpoint() string

AuthorizationEndpoint returns the authorization endpoint for the targeted Cloud Controller.

func (*Client) CheckRoute

func (client *Client) CheckRoute(route Route) (bool, Warnings, error)

CheckRoute returns true if the route exists in the CF instance. DomainGUID is required for check. This call will only work for CC API 2.55 or higher.

func (*Client) CreateApplication

func (client *Client) CreateApplication(app Application) (Application, Warnings, error)

CreateApplication creates a cloud controller application in with the given settings. SpaceGUID and Name are the only required fields.

func (*Client) CreateRoute

func (client *Client) CreateRoute(route Route, generatePort bool) (Route, Warnings, error)

CreateRoute creates the route with the given properties; SpaceGUID and DomainGUID are required. Set generatePort true to generate a random port on the cloud controller. generatePort takes precedence over manually specified port. Setting the port and generatePort only works with CC API 2.53.0 or higher and when TCP router groups are enabled.

func (*Client) CreateServiceBinding

func (client *Client) CreateServiceBinding(appGUID string, serviceInstanceGUID string, parameters map[string]interface{}) (ServiceBinding, Warnings, error)

CreateServiceBinding creates a service binding

func (*Client) CreateUser

func (client *Client) CreateUser(uaaUserID string) (User, Warnings, error)

CreateUser creates a new Cloud Controller User from the provided UAA user ID.

func (*Client) DeleteOrganization

func (client *Client) DeleteOrganization(guid string) (Job, Warnings, error)

DeleteOrganization deletes the Organization associated with the provided GUID. It will return the Cloud Controller job that is assigned to the Organization deletion.

func (*Client) DeleteRoute

func (client *Client) DeleteRoute(routeGUID string) (Warnings, error)

DeleteRoute deletes the Route associated with the provided Route GUID.

func (*Client) DeleteRouteApplication

func (client *Client) DeleteRouteApplication(routeGUID string, appGUID string) (Warnings, error)

DeleteRouteApplication removes the link between the route and application.

func (*Client) DeleteServiceBinding

func (client *Client) DeleteServiceBinding(serviceBindingGUID string) (Warnings, error)

DeleteServiceBinding will destroy the requested Service Binding.

func (*Client) DeleteSpace

func (client *Client) DeleteSpace(guid string) (Job, Warnings, error)

DeleteSpace deletes the Space associated with the provided GUID. It will return the Cloud Controller job that is assigned to the Space deletion.

func (*Client) DopplerEndpoint

func (client *Client) DopplerEndpoint() string

DopplerEndpoint returns the Doppler endpoint for the targetd Cloud Controller.

func (*Client) GetApplication

func (client *Client) GetApplication(guid string) (Application, Warnings, error)

GetApplication returns back an Application.

func (*Client) GetApplicationInstanceStatusesByApplication

func (client *Client) GetApplicationInstanceStatusesByApplication(guid string) (map[int]ApplicationInstanceStatus, Warnings, error)

GetApplicationInstanceStatusesByApplication returns a list of ApplicationInstance for a given application. Given the state of an application, it might skip some application instances.

func (*Client) GetApplicationInstancesByApplication

func (client *Client) GetApplicationInstancesByApplication(guid string) (map[int]ApplicationInstance, Warnings, error)

GetApplicationInstancesByApplication returns a list of ApplicationInstance for a given application. Given the state of an application, it might skip some application instances.

func (*Client) GetApplicationRoutes

func (client *Client) GetApplicationRoutes(appGUID string, queryParams ...QQuery) ([]Route, Warnings, error)

GetApplicationRoutes returns a list of Routes associated with the provided Application GUID, and filtered by the provided queries.

func (*Client) GetApplications

func (client *Client) GetApplications(queries ...QQuery) ([]Application, Warnings, error)

GetApplications returns back a list of Applications based off of the provided queries.

func (Client) GetConfigFeatureFlags

func (client Client) GetConfigFeatureFlags() ([]FeatureFlag, Warnings, error)

func (*Client) GetJob

func (client *Client) GetJob(jobGUID string) (Job, Warnings, error)

GetJob returns a job for the provided GUID.

func (*Client) GetOrganization

func (client *Client) GetOrganization(guid string) (Organization, Warnings, error)

GetOrganization returns an Organization associated with the provided guid.

func (*Client) GetOrganizationPrivateDomains

func (client *Client) GetOrganizationPrivateDomains(orgGUID string, queries ...QQuery) ([]Domain, Warnings, error)

GetOrganizationPrivateDomains returns the private domains associated with an organization.

func (*Client) GetOrganizationQuota

func (client *Client) GetOrganizationQuota(guid string) (OrganizationQuota, Warnings, error)

GetOrganizaitonQuota gets an organization quota (quota definition) from the API.

func (*Client) GetOrganizations

func (client *Client) GetOrganizations(queries ...QQuery) ([]Organization, Warnings, error)

GetOrganizations returns back a list of Organizations based off of the provided queries.

func (*Client) GetPrivateDomain

func (client *Client) GetPrivateDomain(domainGUID string) (Domain, Warnings, error)

GetPrivateDomain returns the Private Domain associated with the provided Domain GUID.

func (*Client) GetRouteApplications

func (client *Client) GetRouteApplications(routeGUID string, queryParams ...QQuery) ([]Application, Warnings, error)

GetRouteApplications returns a list of Applications associated with a route GUID, filtered by provided queries.

func (*Client) GetRoutes

func (client *Client) GetRoutes(queryParams ...QQuery) ([]Route, Warnings, error)

GetRoutes returns a list of Routes based off of the provided queries.

func (*Client) GetRunningSpacesBySecurityGroup

func (client *Client) GetRunningSpacesBySecurityGroup(securityGroupGUID string) ([]Space, Warnings, error)

GetRunningSpacesBySecurityGroup returns a list of Spaces based on the provided SecurityGroup GUID.

func (*Client) GetSecurityGroups

func (client *Client) GetSecurityGroups(queries ...QQuery) ([]SecurityGroup, Warnings, error)

func (*Client) GetService

func (client *Client) GetService(serviceGUID string) (Service, Warnings, error)

GetService returns the service with the given GUID.

func (*Client) GetServiceBindings

func (client *Client) GetServiceBindings(queries ...QQuery) ([]ServiceBinding, Warnings, error)

GetServiceBindings returns back a list of Service Bindings based off of the provided queries.

func (*Client) GetServiceInstance

func (client *Client) GetServiceInstance(serviceInstanceGUID string) (ServiceInstance, Warnings, error)

GetServiceInstance returns the service instance with the given GUID. This service can be either a managed or user provided.

func (*Client) GetServiceInstanceServiceBindings

func (client *Client) GetServiceInstanceServiceBindings(serviceInstanceGUID string) ([]ServiceBinding, Warnings, error)

GetServiceInstanceServiceBindings returns back a list of Service Bindings for the provided service instance GUID.

func (*Client) GetServiceInstanceSharedFrom

func (client *Client) GetServiceInstanceSharedFrom(serviceInstanceGUID string) (ServiceInstanceSharedFrom, Warnings, error)

GetServiceInstanceSharedFrom returns back a ServiceInstanceSharedFrom object.

func (*Client) GetServiceInstanceSharedTos

func (client *Client) GetServiceInstanceSharedTos(serviceInstanceGUID string) ([]ServiceInstanceSharedTo, Warnings, error)

func (*Client) GetServiceInstances

func (client *Client) GetServiceInstances(queries ...QQuery) ([]ServiceInstance, Warnings, error)

GetServiceInstances returns back a list of *managed* Service Instances based off of the provided queries.

func (*Client) GetServicePlan

func (client *Client) GetServicePlan(servicePlanGUID string) (ServicePlan, Warnings, error)

GetServicePlan returns the service plan with the given GUID.

func (*Client) GetSharedDomain

func (client *Client) GetSharedDomain(domainGUID string) (Domain, Warnings, error)

GetSharedDomain returns the Shared Domain associated with the provided Domain GUID.

func (*Client) GetSharedDomains

func (client *Client) GetSharedDomains(queries ...QQuery) ([]Domain, Warnings, error)

GetSharedDomains returns the global shared domains.

func (*Client) GetSpaceQuota

func (client *Client) GetSpaceQuota(guid string) (SpaceQuota, Warnings, error)

GetSpaceQuota returns a Space Quota.

func (*Client) GetSpaceRoutes

func (client *Client) GetSpaceRoutes(spaceGUID string, queryParams ...QQuery) ([]Route, Warnings, error)

GetSpaceRoutes returns a list of Routes associated with the provided Space GUID, and filtered by the provided queries.

func (*Client) GetSpaceRunningSecurityGroupsBySpace

func (client *Client) GetSpaceRunningSecurityGroupsBySpace(spaceGUID string, queries ...QQuery) ([]SecurityGroup, Warnings, error)

GetSpaceRunningSecurityGroupsBySpace returns the running Security Groups associated with the provided Space GUID.

func (*Client) GetSpaceServiceInstances

func (client *Client) GetSpaceServiceInstances(spaceGUID string, includeUserProvidedServices bool, queries ...QQuery) ([]ServiceInstance, Warnings, error)

GetSpaceServiceInstances returns back a list of Service Instances based off of the space and queries provided. User provided services will be included if includeUserProvidedServices is set to true.

func (*Client) GetSpaceStagingSecurityGroupsBySpace

func (client *Client) GetSpaceStagingSecurityGroupsBySpace(spaceGUID string, queries ...QQuery) ([]SecurityGroup, Warnings, error)

GetSpaceStagingSecurityGroupsBySpace returns the staging Security Groups associated with the provided Space GUID.

func (*Client) GetSpaces

func (client *Client) GetSpaces(queries ...QQuery) ([]Space, Warnings, error)

GetSpaces returns a list of Spaces based off of the provided queries.

func (*Client) GetStack

func (client *Client) GetStack(guid string) (Stack, Warnings, error)

GetStack returns the requested stack.

func (*Client) GetStacks

func (client *Client) GetStacks(queries ...QQuery) ([]Stack, Warnings, error)

GetStacks returns a list of Stacks based off of the provided queries.

func (*Client) GetStagingSpacesBySecurityGroup

func (client *Client) GetStagingSpacesBySecurityGroup(securityGroupGUID string) ([]Space, Warnings, error)

GetStagingSpacesBySecurityGroup returns a list of Spaces based on the provided SecurityGroup GUID.

func (*Client) GetUserProvidedServiceInstanceServiceBindings

func (client *Client) GetUserProvidedServiceInstanceServiceBindings(userProvidedServiceInstanceGUID string) ([]ServiceBinding, Warnings, error)

GetUserProvidedServiceInstanceServiceBindings returns back a list of Service Bindings for the provided user provided service instance GUID.

func (*Client) Info

func (client *Client) Info() (APIInformation, Warnings, error)

Info returns back endpoint and API information from /v2/info.

func (*Client) MinCLIVersion

func (client *Client) MinCLIVersion() string

MinCLIVersion returns the minimum CLI version required for the targeted Cloud Controller

func (*Client) PollJob

func (client *Client) PollJob(job 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 (*Client) RemoveSpaceFromRunningSecurityGroup

func (client *Client) RemoveSpaceFromRunningSecurityGroup(securityGroupGUID string, spaceGUID string) (Warnings, error)

RemoveSpaceRunningFromSecurityGroup disassociates a security group in the running phase fo the lifecycle, specified by its GUID, from a space, which is also specified by its GUID.

func (*Client) RemoveSpaceFromStagingSecurityGroup

func (client *Client) RemoveSpaceFromStagingSecurityGroup(securityGroupGUID string, spaceGUID string) (Warnings, error)

RemoveSpaceStagingFromSecurityGroup disassociates a security group in the staging phase fo the lifecycle, specified by its GUID, from a space, which is also specified by its GUID.

func (*Client) ResourceMatch

func (client *Client) ResourceMatch(resourcesToMatch []Resource) ([]Resource, Warnings, error)

ResourceMatch returns the resources that exist on the cloud foundry instance from the set of resources given.

func (*Client) RestageApplication

func (client *Client) RestageApplication(app Application) (Application, Warnings, error)

RestageApplication restages the application with the given GUID.

func (*Client) RoutingEndpoint

func (client *Client) RoutingEndpoint() string

RoutingEndpoint returns the Routing endpoint for the targeted Cloud Controller.

func (*Client) TargetCF

func (client *Client) TargetCF(settings TargetSettings) (Warnings, error)

TargetCF sets the client to use the Cloud Controller specified in the configuration. Any other configuration is also applied to the client.

func (*Client) TokenEndpoint

func (client *Client) TokenEndpoint() string

TokenEndpoint returns the Token endpoint for the targeted Cloud Controller.

func (*Client) UpdateApplication

func (client *Client) UpdateApplication(app Application) (Application, Warnings, error)

UpdateApplication updates the application with the given GUID. Note: Sending DockerImage and StackGUID at the same time will result in an API error.

func (*Client) UpdateRouteApplication

func (client *Client) UpdateRouteApplication(routeGUID string, appGUID string) (Route, Warnings, error)

UpdateRouteApplication creates a link between the route and application.

func (*Client) UploadApplicationPackage

func (client *Client) UploadApplicationPackage(appGUID string, existingResources []Resource, newResources Reader, newResourcesLength int64) (Job, Warnings, error)

UploadApplicationPackage uploads the newResources and a list of existing resources to the cloud controller. A job that combines the requested/newly uploaded bits is returned. The function will act differently given the following Readers:

io.ReadSeeker: Will function properly on retry.
io.Reader: Will return a ccerror.PipeSeekError on retry.
nil: Will not add the "application" section to the request.
newResourcesLength is ignored in this case.

func (*Client) UploadDroplet

func (client *Client) UploadDroplet(appGUID string, droplet io.Reader, dropletLength int64) (Job, Warnings, error)

func (*Client) WrapConnection

func (client *Client) WrapConnection(wrapper ConnectionWrapper)

WrapConnection wraps the current Client connection in the wrapper.

type Config

type Config struct {
	// AppName is the name of the application/process using the client.
	AppName string

	// AppVersion is the version of the application/process using the client.
	AppVersion string

	// JobPollingTimeout is the maximum amount of time a job polls for.
	JobPollingTimeout time.Duration

	// JobPollingInterval is the wait time between job polls.
	JobPollingInterval time.Duration

	// Wrappers that apply to the client connection.
	Wrappers []ConnectionWrapper
}

Config allows the Client to be configured

type ConnectionWrapper

type ConnectionWrapper interface {
	cloudcontroller.Connection
	Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection
}

ConnectionWrapper can wrap a given connection allowing the wrapper to modify all requests going in and out of the given connection.

type DockerCredentials

type DockerCredentials struct {
	// Username is the username for a user that has access to a given docker
	// image.
	Username string `json:"username,omitempty"`

	// Password is the password for the user.
	Password string `json:"password,omitempty"`
}

DockerCredentials are the authentication credentials to pull a docker image from it's repository.

type Domain

type Domain struct {
	GUID            string
	Name            string
	RouterGroupGUID string
	RouterGroupType constant.RouterGroupType
	Type            constant.DomainType
}

Domain represents a Cloud Controller Domain.

func (*Domain) UnmarshalJSON

func (domain *Domain) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Domain response.

type FeatureFlag

type FeatureFlag struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
}

FeatureFlag represents a Cloud Controller feature flag.

type Job

type Job struct {
	Error        string
	ErrorDetails struct {
		Description string
	}
	GUID   string
	Status JobStatus
}

Job represents a Cloud Controller Job.

func (Job) Failed

func (job Job) Failed() bool

Failed returns true when the job has completed with an error/failure.

func (Job) Finished

func (job Job) Finished() bool

Finished returns true when the job has completed successfully.

func (*Job) UnmarshalJSON

func (job *Job) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Job response.

type JobStatus

type JobStatus string

JobStatus is the current state of a job.

const (
	// JobStatusFailed is when the job is no longer running due to a failure.
	JobStatusFailed JobStatus = "failed"

	// JobStatusFinished is when the job is no longer and it was successful.
	JobStatusFinished JobStatus = "finished"

	// JobStatusQueued is when the job is waiting to be run.
	JobStatusQueued JobStatus = "queued"

	// JobStatusRunning is when the job is running.
	JobStatusRunning JobStatus = "running"
)

type LastOperation

type LastOperation struct {
	Type        string
	State       string
	Description string
	UpdatedAt   string
	CreatedAt   string
}

type Organization

type Organization struct {
	GUID                        string
	Name                        string
	QuotaDefinitionGUID         string
	DefaultIsolationSegmentGUID string
}

Organization represents a Cloud Controller Organization.

func (*Organization) UnmarshalJSON

func (org *Organization) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Organization response.

type OrganizationQuota

type OrganizationQuota struct {
	GUID string
	Name string
}

OrganizationQuota is the definition of a quota for an organization.

func (*OrganizationQuota) UnmarshalJSON

func (application *OrganizationQuota) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller organization quota response.

type PaginatedResources

type PaginatedResources struct {
	NextURL        string          `json:"next_url"`
	ResourcesBytes json.RawMessage `json:"resources"`
	// contains filtered or unexported fields
}

PaginatedResources represents a page of resources returned by the Cloud Controller.

func NewPaginatedResources

func NewPaginatedResources(exampleResource interface{}) *PaginatedResources

NewPaginatedResources returns a new PaginatedResources struct with the given resource type.

func (PaginatedResources) Resources

func (pr PaginatedResources) Resources() ([]interface{}, error)

Resources unmarshals JSON representing a page of resources and returns a slice of the given resource type.

type Params

type Params map[string]string

Params represents URI parameters for a request.

type QQuery

type QQuery struct {
	Filter   QQueryFilter
	Operator QQueryOperator
	Values   []string
}

QQuery is a type of filter that can be passed to specific request to narrow down the return set.

type QQueryFilter

type QQueryFilter string

QQueryFilter is the type of filter a QQuery uses.

const (
	// AppGUIDFilter is the name of the 'app_guid' filter.
	AppGUIDFilter QQueryFilter = "app_guid"
	// DomainGUIDFilter is the name of the 'domain_guid' filter.
	DomainGUIDFilter QQueryFilter = "domain_guid"
	// OrganizationGUIDFilter is the name of the 'organization_guid' filter.
	OrganizationGUIDFilter QQueryFilter = "organization_guid"
	// RouteGUIDFilter is the name of the 'route_guid' filter.
	RouteGUIDFilter QQueryFilter = "route_guid"
	// ServiceInstanceGUIDFilter is the name of the 'service_instance_guid' filter.
	ServiceInstanceGUIDFilter QQueryFilter = "service_instance_guid"
	// SpaceGUIDFilter is the name of the 'space_guid' filter.
	SpaceGUIDFilter QQueryFilter = "space_guid"

	// NameFilter is the name of the 'name' filter.
	NameFilter QQueryFilter = "name"
	// HostFilter is the name of the 'host' filter.
	HostFilter QQueryFilter = "host"
	// PathFilter is the name of the 'path' filter.
	PathFilter QQueryFilter = "path"
	// PortFilter is the name of the 'port' filter.
	PortFilter QQueryFilter = "port"
)

type QQueryOperator

type QQueryOperator string

QQueryOperator is the type of operation a QQuery uses.

const (
	// EqualOperator is the query equal operator.
	EqualOperator QQueryOperator = ":"

	// InOperator is the query "IN" operator.
	InOperator QQueryOperator = " IN "
)

type Reader

type Reader interface {
	io.Reader
}

Reader is an io.Reader.

type Resource

type Resource struct {
	Filename string      `json:"fn"`
	Mode     os.FileMode `json:"mode"`
	SHA1     string      `json:"sha1"`
	Size     int64       `json:"size"`
}

func (Resource) MarshalJSON

func (r Resource) MarshalJSON() ([]byte, error)

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(rawJSON []byte) error

type Route

type Route struct {
	GUID       string        `json:"-"`
	Host       string        `json:"host,omitempty"`
	Path       string        `json:"path,omitempty"`
	Port       types.NullInt `json:"port,omitempty"`
	DomainGUID string        `json:"domain_guid"`
	SpaceGUID  string        `json:"space_guid"`
}

Route represents a Cloud Controller Route.

func (*Route) UnmarshalJSON

func (route *Route) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Route response.

type SecurityGroup

type SecurityGroup struct {
	GUID           string
	Name           string
	Rules          []SecurityGroupRule
	RunningDefault bool
	StagingDefault bool
}

func (*SecurityGroup) UnmarshalJSON

func (securityGroup *SecurityGroup) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Security Group response

type SecurityGroupLifecycle

type SecurityGroupLifecycle string

SecurityGroupLifecycle represents the lifecycle phase of a security group binding.

const (
	// SecurityGroupLifecycleRunning indicates the lifecycle phase running.
	SecurityGroupLifecycleRunning SecurityGroupLifecycle = "running"

	// SecurityGroupLifecycleStaging indicates the lifecycle phase staging.
	SecurityGroupLifecycleStaging SecurityGroupLifecycle = "staging"
)

type SecurityGroupRule

type SecurityGroupRule struct {
	Description string
	Destination string
	Ports       string
	Protocol    string
}

type Service

type Service struct {
	GUID             string
	Label            string
	Description      string
	DocumentationURL string
}

func (*Service) UnmarshalJSON

func (service *Service) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Service response.

type ServiceBinding

type ServiceBinding struct {
	GUID                string
	AppGUID             string
	ServiceInstanceGUID string
}

ServiceBinding represents a Cloud Controller Service Binding.

func (*ServiceBinding) UnmarshalJSON

func (serviceBinding *ServiceBinding) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Service Binding response.

type ServiceInstance

type ServiceInstance struct {
	GUID            string
	Name            string
	SpaceGUID       string
	ServicePlanGUID string
	Type            ServiceInstanceType
	Tags            []string
	DashboardURL    string
	LastOperation   LastOperation
}

ServiceInstance represents a Cloud Controller Service Instance.

func (ServiceInstance) Managed

func (serviceInstance ServiceInstance) Managed() bool

Managed returns true if the Service Instance is a managed service.

func (*ServiceInstance) UnmarshalJSON

func (serviceInstance *ServiceInstance) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Service Instance response.

func (ServiceInstance) UserProvided

func (serviceInstance ServiceInstance) UserProvided() bool

UserProvided returns true if the Service Instance is a user provided service.

type ServiceInstanceSharedFrom

type ServiceInstanceSharedFrom struct {
	SpaceGUID        string `json:"space_guid"`
	SpaceName        string `json:"space_name"`
	OrganizationName string `json:"organization_name"`
}

ServiceInstanceSharedFrom is the struct representation of a share_from object in Cloud Controller.

type ServiceInstanceSharedTo

type ServiceInstanceSharedTo struct {
	SpaceGUID        string `json:"space_guid"`
	SpaceName        string `json:"space_name"`
	OrganizationName string `json:"organization_name"`
	BoundAppCount    int    `json:"bound_app_count"`
}

type ServiceInstanceType

type ServiceInstanceType string

ServiceInstanceType is the type of the Service Instance.

const (
	// UserProvidedService is a Service Instance that is created by a user.
	UserProvidedService ServiceInstanceType = "user_provided_service_instance"

	// ManagedService is a Service Instance that is managed by a service broker.
	ManagedService ServiceInstanceType = "managed_service_instance"
)

type ServicePlan

type ServicePlan struct {
	GUID        string
	Name        string
	ServiceGUID string
}

func (*ServicePlan) UnmarshalJSON

func (servicePlan *ServicePlan) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Service Plan response.

type Space

type Space struct {
	GUID                     string
	OrganizationGUID         string
	Name                     string
	AllowSSH                 bool
	SpaceQuotaDefinitionGUID string
}

Space represents a Cloud Controller Space.

func (*Space) UnmarshalJSON

func (space *Space) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Space response.

type SpaceQuota

type SpaceQuota struct {
	GUID string
	Name string
}

func (*SpaceQuota) UnmarshalJSON

func (spaceQuota *SpaceQuota) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Space Quota response.

type Stack

type Stack struct {
	GUID        string
	Name        string
	Description string
}

Stack represents a Cloud Controller Stack.

func (*Stack) UnmarshalJSON

func (stack *Stack) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller Stack response.

type TargetSettings

type TargetSettings struct {
	// DialTimeout is the DNS timeout used to make all requests to the Cloud
	// Controller.
	DialTimeout time.Duration

	// SkipSSLValidation controls whether a client verifies the server's
	// certificate chain and host name. If SkipSSLValidation is true, TLS accepts
	// any certificate presented by the server and any host name in that
	// certificate for *all* client requests going forward.
	//
	// In this mode, TLS is susceptible to man-in-the-middle attacks. This should
	// be used only for testing.
	SkipSSLValidation bool

	// URL is a fully qualified URL to the Cloud Controller API.
	URL string
}

TargetSettings represents configuration for establishing a connection to the Cloud Controller server.

type User

type User struct {
	GUID string
}

User represents a Cloud Controller User.

func (*User) UnmarshalJSON

func (user *User) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal a Cloud Controller User response.

type Warnings

type Warnings []string

Warnings are a collection of warnings that the Cloud Controller can return back from an API request.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
Package constant contains types and constants used by the ccv2 package.
Package constant contains types and constants used by the ccv2 package.

Jump to

Keyboard shortcuts

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