cf

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRetryTimeout sets the amount of time before a retry times out
	DefaultRetryTimeout = time.Minute
	// DefaultRetryPause sets the amount of time to wait before retrying
	DefaultRetryPause = 3 * time.Second
)

Variables

View Source
var ErrRetry = errors.New("retry")

Functions

func CreateServiceInstance

func CreateServiceInstance(e exec.Executor, cfHome string, instance ServiceInstance) flow.StepFunc

func GetServiceInstance

func GetServiceInstance(e exec.Executor, cfHome string, instance *ServiceInstance, duration time.Duration, pause time.Duration) flow.StepFunc

func LoginSourceFoundation

func LoginSourceFoundation(e exec.Executor, om config.OpsManager, api, org, space, cfHome string) flow.StepFunc

func LoginTargetFoundation

func LoginTargetFoundation(e exec.Executor, om config.OpsManager, api, org, space, cfHome string) flow.StepFunc

func WithRetryPause

func WithRetryPause(pause time.Duration) func(*ClientImpl)

func WithRetryTimeout

func WithRetryTimeout(timeout time.Duration) func(*ClientImpl)

Types

type Application

type Application struct {
	Name       string   `yaml:"name"`
	Buildpacks []string `yaml:"buildpacks"`
	Command    string   `yaml:"command"`
	DiskQuota  string   `yaml:"disk_quota"`
	Docker     struct {
		Image    string `yaml:"image,omitempty"`
		Username string `yaml:"username,omitempty"`
	} `yaml:"docker,omitempty"`
	Env                     map[string]interface{} `yaml:"env"`
	HealthCheckType         string                 `yaml:"health-check-type"`
	HealthCheckHTTPEndpoint string                 `yaml:"health-check-http-endpoint,omitempty"`
	Instances               int64                  `yaml:"instances"`
	Memory                  string                 `yaml:"memory"`
	NoRoute                 bool                   `yaml:"no-route,omitempty"`
	Routes                  []struct {
		Route string `yaml:"route,omitempty"`
	} `yaml:"routes,omitempty"`
	Services []string `yaml:"services"`
	Stack    string   `yaml:"stack"`
	Timeout  int64    `yaml:"timeout,omitempty"`
}

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *Cache

func (*Cache) Load

func (c *Cache) Load(key string) (value interface{}, ok bool)

Load retrieves the item from the cache if exists. Returns the val and true if it exists otherwise false.

func (*Cache) LoadOrStore

func (c *Cache) LoadOrStore(key string, val interface{}) (actual interface{}, loaded bool)

LoadOrStore atomically returns the already stored object if found and true, otherwise it stores the given object, returns val and false

func (*Cache) Store

func (c *Cache) Store(key string, val interface{})

Store atomically stores the given object regardless if it exists

type CachingClient

type CachingClient struct {
	*cfclient.Client
	// contains filtered or unexported fields
}

func NewCachingClient

func NewCachingClient(client *cfclient.Client) *CachingClient

func (*CachingClient) GetOrgByGuid

func (c *CachingClient) GetOrgByGuid(orgGUID string) (cfclient.Org, error)

func (*CachingClient) GetOrgByName

func (c *CachingClient) GetOrgByName(name string) (cfclient.Org, error)

func (*CachingClient) GetServiceByGuid

func (c *CachingClient) GetServiceByGuid(serviceGUID string) (cfclient.Service, error)

func (*CachingClient) GetServicePlanByGUID

func (c *CachingClient) GetServicePlanByGUID(servicePlanGUID string) (*cfclient.ServicePlan, error)

func (*CachingClient) GetSpaceByGuid

func (c *CachingClient) GetSpaceByGuid(spaceGUID string) (cfclient.Space, error)

func (*CachingClient) GetSpaceByName

func (c *CachingClient) GetSpaceByName(name string, orgGUID string) (cfclient.Space, error)

func (*CachingClient) ListOrgs

func (c *CachingClient) ListOrgs() ([]cfclient.Org, error)

func (*CachingClient) ListSpaces

func (c *CachingClient) ListSpaces() ([]cfclient.Space, error)

type Client

type Client interface {
	AppByName(appName, spaceGuid, orgGuid string) (cfclient.App, error)
	CreateApp(req cfclient.AppCreateRequest) (cfclient.App, error)
	DeleteApp(guid string) error
	CreateOrg(req cfclient.OrgRequest) (cfclient.Org, error)
	CreateServiceBinding(appGUID, serviceInstanceGUID string) (*cfclient.ServiceBinding, error)
	CreateServiceInstance(req cfclient.ServiceInstanceRequest) (cfclient.ServiceInstance, error)
	CreateServiceKey(req cfclient.CreateServiceKeyRequest) (cfclient.ServiceKey, error)
	CreateSpace(req cfclient.SpaceRequest) (cfclient.Space, error)
	CreateUserProvidedServiceInstance(req cfclient.UserProvidedServiceInstanceRequest) (*cfclient.UserProvidedServiceInstance, error)
	DeleteOrg(guid string, recursive, async bool) error
	DeleteServiceBinding(guid string) error
	DeleteServiceInstance(guid string, recursive, async bool) error
	GetAppByGuidNoInlineCall(guid string) (cfclient.App, error)
	GetClientConfig() *cfclient.Config
	GetOrgByGuid(guid string) (cfclient.Org, error)
	GetOrgByName(name string) (cfclient.Org, error)
	GetSpaceByGuid(spaceGUID string) (cfclient.Space, error)
	GetSpaceByName(name string, orgGUID string) (cfclient.Space, error)
	GetServiceByGuid(guid string) (cfclient.Service, error)
	GetServicePlanByGUID(guid string) (*cfclient.ServicePlan, error)
	GetServiceInstanceByGuid(guid string) (cfclient.ServiceInstance, error)
	GetServiceInstanceParams(guid string) (map[string]interface{}, error)
	GetUserProvidedServiceInstanceByGuid(guid string) (cfclient.UserProvidedServiceInstance, error)
	ListOrgs() ([]cfclient.Org, error)
	ListUserProvidedServiceInstancesByQuery(query url.Values) ([]cfclient.UserProvidedServiceInstance, error)
	ListServices() ([]cfclient.Service, error)
	ListServiceBindingsByQuery(query url.Values) ([]cfclient.ServiceBinding, error)
	ListServiceKeysByQuery(query url.Values) ([]cfclient.ServiceKey, error)
	ListServiceInstancesByQuery(query url.Values) ([]cfclient.ServiceInstance, error)
	ListSpaceServiceInstances(spaceGUID string) ([]cfclient.ServiceInstance, error)
	ListServicePlans() ([]cfclient.ServicePlan, error)
	ListSpaces() ([]cfclient.Space, error)
	ListSpacesByQuery(query url.Values) ([]cfclient.Space, error)
	ListServiceBrokers() ([]cfclient.ServiceBroker, error)
	ListServicePlansByQuery(values url.Values) ([]cfclient.ServicePlan, error)
	UpdateUserProvidedServiceInstance(guid string, req cfclient.UserProvidedServiceInstanceRequest) (*cfclient.UserProvidedServiceInstance, error)
	UpdateSI(serviceInstanceGuid string, req cfclient.ServiceInstanceUpdateRequest, async bool) error
	NewRequest(method, path string) *cfclient.Request
	DoRequest(req *cfclient.Request) (*http.Response, error)
	DoWithRetry(f func() error) error
}

type ClientImpl

type ClientImpl struct {
	CachingClient *CachingClient
	RetryPause    time.Duration
	RetryTimeout  time.Duration
	Config        *Config

	*cfclient.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c *Config, options ...func(*ClientImpl)) (*ClientImpl, error)

func (*ClientImpl) AppByName

func (c *ClientImpl) AppByName(appName, spaceGuid, orgGuid string) (cfclient.App, error)

func (*ClientImpl) CreateOrg

func (c *ClientImpl) CreateOrg(request cfclient.OrgRequest) (cfclient.Org, error)

func (*ClientImpl) DoRequest

func (c *ClientImpl) DoRequest(req *cfclient.Request) (*http.Response, error)

func (*ClientImpl) DoWithRetry

func (c *ClientImpl) DoWithRetry(f func() error) error

func (*ClientImpl) GetAppByGuidNoInlineCall

func (c *ClientImpl) GetAppByGuidNoInlineCall(guid string) (cfclient.App, error)

func (*ClientImpl) GetClientConfig

func (c *ClientImpl) GetClientConfig() *cfclient.Config

func (*ClientImpl) GetOrgByGuid

func (c *ClientImpl) GetOrgByGuid(guid string) (cfclient.Org, error)

func (*ClientImpl) GetOrgByName

func (c *ClientImpl) GetOrgByName(name string) (cfclient.Org, error)

func (*ClientImpl) GetServiceByGuid

func (c *ClientImpl) GetServiceByGuid(guid string) (cfclient.Service, error)

func (*ClientImpl) GetServiceInstanceByGuid

func (c *ClientImpl) GetServiceInstanceByGuid(guid string) (cfclient.ServiceInstance, error)

func (*ClientImpl) GetServiceInstanceParams

func (c *ClientImpl) GetServiceInstanceParams(guid string) (map[string]interface{}, error)

func (*ClientImpl) GetServicePlanByGUID

func (c *ClientImpl) GetServicePlanByGUID(guid string) (*cfclient.ServicePlan, error)

func (*ClientImpl) GetSpaceByGuid

func (c *ClientImpl) GetSpaceByGuid(spaceGUID string) (cfclient.Space, error)

func (*ClientImpl) GetSpaceByName

func (c *ClientImpl) GetSpaceByName(name string, orgGUID string) (cfclient.Space, error)

func (*ClientImpl) ListOrgs

func (c *ClientImpl) ListOrgs() ([]cfclient.Org, error)

func (*ClientImpl) ListServiceBindingsByQuery

func (c *ClientImpl) ListServiceBindingsByQuery(query url.Values) ([]cfclient.ServiceBinding, error)

func (*ClientImpl) ListServiceBrokers

func (c *ClientImpl) ListServiceBrokers() ([]cfclient.ServiceBroker, error)

func (*ClientImpl) ListServiceInstancesByQuery

func (c *ClientImpl) ListServiceInstancesByQuery(query url.Values) ([]cfclient.ServiceInstance, error)

func (*ClientImpl) ListServiceKeysByQuery

func (c *ClientImpl) ListServiceKeysByQuery(query url.Values) ([]cfclient.ServiceKey, error)

func (*ClientImpl) ListServicePlans

func (c *ClientImpl) ListServicePlans() ([]cfclient.ServicePlan, error)

func (*ClientImpl) ListServicePlansByQuery

func (c *ClientImpl) ListServicePlansByQuery(values url.Values) ([]cfclient.ServicePlan, error)

func (*ClientImpl) ListServices

func (c *ClientImpl) ListServices() ([]cfclient.Service, error)

func (*ClientImpl) ListSpaceServiceInstances

func (c *ClientImpl) ListSpaceServiceInstances(spaceGUID string) ([]cfclient.ServiceInstance, error)

func (*ClientImpl) ListSpaces

func (c *ClientImpl) ListSpaces() ([]cfclient.Space, error)

func (*ClientImpl) ListSpacesByQuery

func (c *ClientImpl) ListSpacesByQuery(query url.Values) ([]cfclient.Space, error)

func (*ClientImpl) ListUserProvidedServiceInstancesByQuery

func (c *ClientImpl) ListUserProvidedServiceInstancesByQuery(query url.Values) ([]cfclient.UserProvidedServiceInstance, error)

func (*ClientImpl) NewRequest

func (c *ClientImpl) NewRequest(method, path string) *cfclient.Request

type Config

type Config struct {
	SSLDisabled  bool
	URL          string
	Username     string
	Password     string
	ClientID     string
	ClientSecret string
}

type Manifest

type Manifest struct {
	Applications []Application `yaml:"applications"`
}

type ServiceBinding

type ServiceBinding struct {
	Guid                string                 `yaml:"guid,omitempty"`
	Name                string                 `yaml:"name,omitempty"`
	AppGuid             string                 `yaml:"app_guid,omitempty"`
	ServiceInstanceGuid string                 `yaml:"service_instance_guid,omitempty"`
	Credentials         map[string]interface{} `yaml:"credentials,omitempty"`
	BindingOptions      interface{}            `yaml:"binding_options,omitempty"`
	GatewayData         interface{}            `yaml:"gateway_data,omitempty"`
	GatewayName         string                 `yaml:"gateway_name,omitempty"`
	SyslogDrainUrl      string                 `yaml:"syslog_drain_url,omitempty"`
	VolumeMounts        interface{}            `yaml:"volume_mounts,omitempty"`
	AppUrl              string                 `yaml:"app_url,omitempty"`
	ServiceInstanceUrl  string                 `yaml:"service_instance_url,omitempty"`
}

type ServiceInstance

type ServiceInstance struct {
	Name                string                 `yaml:"name,omitempty"`
	GUID                string                 `yaml:"guid,omitempty"`
	Type                string                 `yaml:"type,omitempty"`
	Tags                string                 `yaml:"tags,omitempty"`
	Params              map[string]interface{} `yaml:"params,omitempty"`
	RouteServiceUrl     string                 `yaml:"route_service_url,omitempty"`
	SyslogDrainUrl      string                 `yaml:"syslog_drain_url,omitempty"`
	DashboardURL        string                 `yaml:"dashboard_url,omitempty"`
	Service             string                 `yaml:"service,omitempty"`
	Plan                string                 `yaml:"plan,omitempty"`
	Credentials         map[string]interface{} `json:"credentials,omitempty"`
	ServiceBindings     []ServiceBinding       `yaml:"service_bindings,omitempty"`
	ServiceKeys         []ServiceKey           `yaml:"service_keys,omitempty"`
	BackupID            string                 `yaml:"backup_id,omitempty"`
	BackupDate          string                 `yaml:"backup_date,omitempty"`
	BackupTime          string                 `yaml:"backup_time,omitempty"`
	BackupFile          string                 `yaml:"backup_file,omitempty"`
	BackupEncryptionKey string                 `yaml:"backup_encryption_key,omitempty"`
	Apps                map[string]string      `yaml:"apps,omitempty"`
	AppManifest         Manifest               `yaml:"app_manifest"`
}

type ServiceKey

type ServiceKey struct {
	Name                string                 `yaml:"name"`
	Guid                string                 `yaml:"guid"`
	ServiceInstanceGuid string                 `yaml:"service_instance_guid"`
	Credentials         map[string]interface{} `yaml:"credentials"`
	ServiceInstanceUrl  string                 `yaml:"service_instance_url"`
}

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