ccv2

package
v6.22.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2016 License: Apache-2.0 Imports: 6 Imported by: 180

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: []ServiceInstances

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

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatQueryParameters

func FormatQueryParameters(queries []Query) 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"`
	LoggregatorEndpoint          string `json:"logging_endpoint"`
	MinimumCLIVersion            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 {
	GUID string
	Name string
}

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 CloudControllerClient

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

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

func NewCloudControllerClient

func NewCloudControllerClient() *CloudControllerClient

NewCloudControllerClient returns a new CloudControllerClient.

func (*CloudControllerClient) API

func (client *CloudControllerClient) API() string

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

func (*CloudControllerClient) APIVersion

func (client *CloudControllerClient) APIVersion() string

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

func (*CloudControllerClient) AuthorizationEndpoint

func (client *CloudControllerClient) AuthorizationEndpoint() string

AuthorizationEndpoint returns the authorization endpoint for the targeted Cloud Controller.

func (*CloudControllerClient) DeleteRoute

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

DeleteRoute deletes the Route associated with the provided Route GUID.

func (*CloudControllerClient) DeleteServiceBinding

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

DeleteServiceBinding will destroy the requested Service Binding.

func (*CloudControllerClient) DopplerEndpoint

func (client *CloudControllerClient) DopplerEndpoint() string

DopplerEndpoint returns the Doppler endpoint for the targetd Cloud Controller.

func (*CloudControllerClient) GetApplications

func (client *CloudControllerClient) GetApplications(queries []Query) ([]Application, Warnings, error)

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

func (*CloudControllerClient) GetPrivateDomain

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

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

func (*CloudControllerClient) GetRouteApplications

func (client *CloudControllerClient) GetRouteApplications(routeGUID string, queryParams []Query) ([]Application, Warnings, error)

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

func (*CloudControllerClient) GetServiceBindings

func (client *CloudControllerClient) GetServiceBindings(queries []Query) ([]ServiceBinding, Warnings, error)

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

func (*CloudControllerClient) GetServiceInstances

func (client *CloudControllerClient) GetServiceInstances(queries []Query) ([]ServiceInstance, Warnings, error)

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

func (*CloudControllerClient) GetSharedDomain

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

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

func (*CloudControllerClient) GetSpaceRoutes

func (client *CloudControllerClient) 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 (*CloudControllerClient) GetSpaceServiceInstances

func (client *CloudControllerClient) 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 (*CloudControllerClient) Info

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

func (*CloudControllerClient) LoggregatorEndpoint

func (client *CloudControllerClient) LoggregatorEndpoint() string

LoggregatorEndpoint returns the Loggregator endpoint for the targeted Cloud Controller.

func (*CloudControllerClient) RoutingEndpoint

func (client *CloudControllerClient) RoutingEndpoint() string

RoutingEndpoint returns the Routing endpoint for the targeted Cloud Controller.

func (*CloudControllerClient) TargetCF

func (client *CloudControllerClient) TargetCF(APIURL string, skipSSLValidation bool) (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 (*CloudControllerClient) TokenEndpoint

func (client *CloudControllerClient) TokenEndpoint() string

TokenEndpoint returns the Token endpoint for the targeted Cloud Controller.

func (*CloudControllerClient) WrapConnection

func (client *CloudControllerClient) WrapConnection(wrapper ConnectionWrapper)

WrapConnection wraps the current CloudControllerClient 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

type Domain struct {
	GUID string
	Name string
}

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 ForbiddenError

type ForbiddenError struct {
	Message string
}

ForbiddenError is returned when the client is forbidden from executing the request.

func (ForbiddenError) Error

func (e ForbiddenError) Error() string

type InvalidAuthTokenError

type InvalidAuthTokenError struct {
	Message string
}

InvalidAuthTokenError is returned when the client has an invalid authorization header.

func (InvalidAuthTokenError) Error

func (e InvalidAuthTokenError) Error() string

type PaginatedWrapper

type PaginatedWrapper struct {
	NextURL   string      `json:"next_url"`
	Resources interface{} `json:"resources"`
}

PaginatedWrapper represents the standard pagination format of a request that returns back more than one object.

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             QueryFilter = "app_guid"
	ServiceInstanceGUIDFilter QueryFilter = "service_instance_guid"
	SpaceGUIDFilter           QueryFilter = "space_guid"

	NameFilter QueryFilter = "name"
)

type QueryOperator

type QueryOperator string

QueryOperator is the type of operation a Query uses.

const (
	EqualOperator QueryOperator = ":"
)

type ResourceNotFoundError

type ResourceNotFoundError struct {
	Message string
}

ResourceNotFoundError is returned when the client requests a resource that does not exist or does not have permissions to see.

func (ResourceNotFoundError) Error

func (e ResourceNotFoundError) Error() string

type Route

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

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 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 UnauthorizedError

type UnauthorizedError struct {
	Message string
}

UnauthorizedError is returned when the client does not have the correct permissions to execute the request.

func (UnauthorizedError) Error

func (e UnauthorizedError) Error() string

type UnexpectedResponseError

type UnexpectedResponseError struct {
	ResponseCode int
	CCErrorResponse
}

UnexpectedResponseError is returned when the client gets an error that has not been accounted for.

func (UnexpectedResponseError) Error

func (e UnexpectedResponseError) Error() string

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
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