Documentation ¶
Overview ¶
Package ccv2 represents a Cloud Controller V2 client.
It is currently designed to support Cloud Controller API 2.29.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 -> New GET -> Get PUT -> Update DELETE -> Delete
Method Locations ¶
Methods exist in the same file as their return type, regardless of which endpoint they use.
Index ¶
- func FormatQueryParameters(queries []Query) url.Values
- type APIInformation
- type Application
- type CCErrorResponse
- type Client
- func (client *Client) API() string
- func (client *Client) APIVersion() string
- func (client *Client) AuthorizationEndpoint() string
- func (client *Client) DeleteOrganization(orgGUID string) (Job, Warnings, error)
- func (client *Client) DeleteRoute(routeGUID string) (Warnings, error)
- func (client *Client) DeleteServiceBinding(serviceBindingGUID string) (Warnings, error)
- func (client *Client) DopplerEndpoint() string
- func (client *Client) GetApplications(queries []Query) ([]Application, Warnings, error)
- func (client *Client) GetJob(jobGUID string) (Job, Warnings, error)
- func (client *Client) GetOrganizations(queries []Query) ([]Organization, Warnings, error)
- func (client *Client) GetPrivateDomain(domainGUID string) (Domain, Warnings, error)
- func (client *Client) GetRouteApplications(routeGUID string, queryParams []Query) ([]Application, Warnings, error)
- func (client *Client) GetServiceBindings(queries []Query) ([]ServiceBinding, Warnings, error)
- func (client *Client) GetServiceInstances(queries []Query) ([]ServiceInstance, Warnings, error)
- func (client *Client) GetSharedDomain(domainGUID string) (Domain, Warnings, error)
- func (client *Client) GetSpaceRoutes(spaceGUID string, queryParams []Query) ([]Route, Warnings, error)
- func (client *Client) GetSpaceServiceInstances(spaceGUID string, includeUserProvidedServices bool, queries []Query) ([]ServiceInstance, Warnings, error)
- func (client *Client) GetSpaces(queries []Query) ([]Space, Warnings, error)
- func (client *Client) Info() (APIInformation, Warnings, error)
- func (client *Client) LoggregatorEndpoint() string
- func (client *Client) MinCLIVersion() string
- func (client *Client) NewUser(uaaUserID string) (User, Warnings, error)
- func (client *Client) RoutingEndpoint() string
- func (client *Client) TargetCF(settings TargetSettings) (Warnings, error)
- func (client *Client) TokenEndpoint() string
- func (client *Client) WrapConnection(wrapper ConnectionWrapper)
- type ConnectionWrapper
- type Domain
- type Job
- type JobStatus
- type Organization
- type PaginatedResources
- type Query
- type QueryFilter
- type QueryOperator
- type Route
- type ServiceBinding
- type ServiceInstance
- type ServiceInstanceType
- type Space
- type TargetSettings
- type UnexpectedResponseError
- type User
- type Warnings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatQueryParameters ¶
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"` LoggregatorEndpoint string `json:"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 ¶
Application represents a Cloud Controller Application.
func (*Application) UnmarshalJSON ¶
func (application *Application) UnmarshalJSON(data []byte) error
UnmarshalJSON helps unmarshal a Cloud Controller Application response.
type CCErrorResponse ¶
type CCErrorResponse struct { Code int `json:"code"` Description string `json:"description"` ErrorCode string `json:"error_code"` }
CCErrorResponse represents a generic Cloud Controller V2 error response.
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 (*Client) APIVersion ¶
APIVersion returns Cloud Controller API Version for the targeted Cloud Controller.
func (*Client) AuthorizationEndpoint ¶
AuthorizationEndpoint returns the authorization endpoint for the targeted Cloud Controller.
func (*Client) DeleteOrganization ¶
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 ¶
DeleteRoute deletes the Route associated with the provided Route GUID.
func (*Client) DeleteServiceBinding ¶
DeleteServiceBinding will destroy the requested Service Binding.
func (*Client) DopplerEndpoint ¶
DopplerEndpoint returns the Doppler endpoint for the targetd Cloud Controller.
func (*Client) GetApplications ¶
func (client *Client) GetApplications(queries []Query) ([]Application, Warnings, error)
GetApplications returns back a list of Applications based off of the provided queries.
func (*Client) GetOrganizations ¶
func (client *Client) GetOrganizations(queries []Query) ([]Organization, Warnings, error)
GetOrganizations returns back a list of Organizations based off of the provided queries.
func (*Client) GetPrivateDomain ¶
GetPrivateDomain returns the Private Domain associated with the provided Domain GUID.
func (*Client) GetRouteApplications ¶
func (client *Client) GetRouteApplications(routeGUID string, queryParams []Query) ([]Application, Warnings, error)
GetRouteApplications returns a list of Applications associated with a route GUID, filtered by provided queries.
func (*Client) GetServiceBindings ¶
func (client *Client) GetServiceBindings(queries []Query) ([]ServiceBinding, Warnings, error)
GetServiceBindings returns back a list of Service Bindings based off of the provided queries.
func (*Client) GetServiceInstances ¶
func (client *Client) GetServiceInstances(queries []Query) ([]ServiceInstance, Warnings, error)
GetServiceInstances returns back a list of *managed* Service Instances based off of the provided queries.
func (*Client) GetSharedDomain ¶
GetSharedDomain returns the Shared Domain associated with the provided Domain GUID.
func (*Client) GetSpaceRoutes ¶
func (client *Client) GetSpaceRoutes(spaceGUID string, queryParams []Query) ([]Route, Warnings, error)
GetSpaceRoutes returns a list of Routes associated with the provided Space GUID, and filtered by the provided queries.
func (*Client) GetSpaceServiceInstances ¶
func (client *Client) GetSpaceServiceInstances(spaceGUID string, includeUserProvidedServices bool, queries []Query) ([]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) GetSpaces ¶
GetSpaces returns back a list of Spaces based off of the provided queries.
func (*Client) Info ¶
func (client *Client) Info() (APIInformation, Warnings, error)
Info returns back endpoint and API information from /v2/info.
func (*Client) LoggregatorEndpoint ¶
LoggregatorEndpoint returns the Loggregator endpoint for the targeted Cloud Controller.
func (*Client) MinCLIVersion ¶
MinCLIVersion returns the minimum CLI version required for the targeted Cloud Controller
func (*Client) RoutingEndpoint ¶
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 at the fully qualified API URL. 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.
func (*Client) TokenEndpoint ¶
TokenEndpoint returns the Token endpoint for the targeted Cloud Controller.
func (*Client) WrapConnection ¶
func (client *Client) WrapConnection(wrapper ConnectionWrapper)
WrapConnection wraps the current Client connection in the wrapper.
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 Domain ¶
Domain represents a Cloud Controller Domain.
func (*Domain) UnmarshalJSON ¶
UnmarshalJSON helps unmarshal a Cloud Controller Domain response.
type Job ¶
Job represents a Cloud Controller Job.
func (*Job) UnmarshalJSON ¶
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 Organization ¶
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 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 Query ¶
type Query struct { Filter QueryFilter Operator QueryOperator Value string }
Query is a type of filter that can be passed to specific request to narrow down the return set.
type QueryFilter ¶
type QueryFilter string
QueryFilter is the type of filter a Query uses.
const ( // AppGUIDFilter is the name of the App GUID filter. AppGUIDFilter QueryFilter = "app_guid" // ServiceInstanceGUIDFilter is the name of the service instance GUID filter. ServiceInstanceGUIDFilter QueryFilter = "service_instance_guid" // SpaceGUIDFilter is the name of the space GUID filter. SpaceGUIDFilter QueryFilter = "space_guid" // OrganizationGUIDFilter is the name of the organization GUID filter. OrganizationGUIDFilter QueryFilter = "organization_guid" // NameFilter is the name of the name filter. NameFilter QueryFilter = "name" )
type QueryOperator ¶
type QueryOperator string
QueryOperator is the type of operation a Query uses.
const ( // EqualOperator is the query equal operator. EqualOperator QueryOperator = ":" )
type Route ¶
Route represents a Cloud Controller Route.
func (*Route) UnmarshalJSON ¶
UnmarshalJSON helps unmarshal a Cloud Controller Route response.
type ServiceBinding ¶
type ServiceBinding struct {
GUID 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 Type ServiceInstanceType }
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
UserProvidedService returns true if the Service Instance is a user provided service.
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 Space ¶
Space represents a Cloud Controller Space.
func (*Space) UnmarshalJSON ¶
UnmarshalJSON helps unmarshal a Cloud Controller Space response.
type TargetSettings ¶
TargetSettings represents configuration for establishing a connection to the Cloud Controller server.
type UnexpectedResponseError ¶
type UnexpectedResponseError struct { CCErrorResponse RequestIDs []string ResponseCode int }
UnexpectedResponseError is returned when the client gets an error that has not been accounted for.
func (UnexpectedResponseError) Error ¶
func (e UnexpectedResponseError) Error() string
type User ¶
type User struct {
GUID string
}
User represents a Cloud Controller User.
func (*User) UnmarshalJSON ¶
UnmarshalJSON helps unmarshal a Cloud Controller User response.