serviceadapter

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 38

Documentation

Index

Constants

View Source
const (
	ErrorExitCode                     = 1
	NotImplementedExitCode            = 10
	BindingNotFoundErrorExitCode      = 41
	AppGuidNotProvidedErrorExitCode   = 42
	BindingAlreadyExistsErrorExitCode = 49

	ODBSecretPrefix = "odb_secret"
)

Variables

This section is empty.

Functions

func GenerateInstanceGroupsWithNoProperties

func GenerateInstanceGroupsWithNoProperties(
	instanceGroups []InstanceGroup,
	serviceReleases ServiceReleases,
	stemcell string,
	deploymentInstanceGroupsToJobs map[string][]string,
) ([]bosh.InstanceGroup, error)

func HandleCLI added in v0.21.0

func HandleCLI(args []string, handler CommandLineHandler)

HandleCLI calls the correct Service Adapter handler method based on command line arguments. The first argument at the command line should be one of: generate-manifest, create-binding, delete-binding, dashboard-url.

func HandleCommandLineInvocation deprecated

func HandleCommandLineInvocation(args []string, manifestGenerator ManifestGenerator, binder Binder, dashboardUrlGenerator DashboardUrlGenerator)

Deprecated: Use HandleCLI method of a CommandLineHandler

HandleCommandLineInvocation constructs a CommandLineHandler based on minimal service adapter interface handlers and runs HandleCLI based on the arguments provided

Types

type Action added in v0.22.0

type Action interface {
	IsImplemented() bool
	ParseArgs(io.Reader, []string) (InputParams, error)
	Execute(InputParams, io.Writer) error
}

type AppGuidNotProvidedError

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

func NewAppGuidNotProvidedError

func NewAppGuidNotProvidedError(err error) AppGuidNotProvidedError

type BOSHConfigs added in v0.26.0

type BOSHConfigs map[string]string

type Binder

type Binder interface {
	CreateBinding(params CreateBindingParams) (Binding, error)
	DeleteBinding(params DeleteBindingParams) error
}

type Binding

type Binding struct {
	Credentials     map[string]interface{} `json:"credentials"`
	SyslogDrainURL  string                 `json:"syslog_drain_url,omitempty"`
	RouteServiceURL string                 `json:"route_service_url,omitempty"`
	BackupAgentURL  string                 `json:"backup_agent_url,omitempty"`
}

type BindingAlreadyExistsError

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

func NewBindingAlreadyExistsError

func NewBindingAlreadyExistsError(err error) BindingAlreadyExistsError

type BindingNotFoundError

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

func NewBindingNotFoundError

func NewBindingNotFoundError(err error) BindingNotFoundError

type CLIHandlerError added in v0.21.0

type CLIHandlerError struct {
	ExitCode int
	Message  string
}

func (CLIHandlerError) Error added in v0.21.0

func (e CLIHandlerError) Error() string

type CommandLineHandler added in v0.21.0

type CommandLineHandler struct {
	ManifestGenerator     ManifestGenerator
	Binder                Binder
	DashboardURLGenerator DashboardUrlGenerator
	SchemaGenerator       SchemaGenerator
}

CommandLineHandler contains all of the implementers required for the service adapter interface

func (CommandLineHandler) Handle added in v0.21.0

func (h CommandLineHandler) Handle(args []string, outputWriter, errorWriter io.Writer, inputParamsReader io.Reader) error

Handle executes required action and returns an error. Writes responses to the writer provided

type CreateBindingAction added in v0.22.0

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

func NewCreateBindingAction added in v0.22.0

func NewCreateBindingAction(binder Binder) *CreateBindingAction

func (*CreateBindingAction) Execute added in v0.22.0

func (a *CreateBindingAction) Execute(inputParams InputParams, outputWriter io.Writer) error

func (*CreateBindingAction) IsImplemented added in v0.22.0

func (a *CreateBindingAction) IsImplemented() bool

func (*CreateBindingAction) ParseArgs added in v0.22.0

func (a *CreateBindingAction) ParseArgs(reader io.Reader, args []string) (InputParams, error)

type CreateBindingJSONParams added in v0.26.0

type CreateBindingJSONParams struct {
	BindingId         string `json:"binding_id"`
	BoshVms           string `json:"bosh_vms"`
	Manifest          string `json:"manifest"`
	RequestParameters string `json:"request_parameters"`
	Secrets           string `json:"secrets"`
	DNSAddresses      string `json:"dns_addresses"`
}

type CreateBindingParams added in v0.22.0

type CreateBindingParams struct {
	BindingID          string
	DeploymentTopology bosh.BoshVMs
	Manifest           bosh.BoshManifest
	RequestParams      RequestParameters
	Secrets            ManifestSecrets
	DNSAddresses       DNSAddresses
}

type DNSAddresses added in v0.22.0

type DNSAddresses map[string]string

type DashboardUrl

type DashboardUrl struct {
	DashboardUrl string `json:"dashboard_url"`
}

type DashboardUrlAction added in v0.22.0

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

func NewDashboardUrlAction added in v0.22.0

func NewDashboardUrlAction(dashboardUrlGenerator DashboardUrlGenerator) *DashboardUrlAction

func (*DashboardUrlAction) Execute added in v0.22.0

func (d *DashboardUrlAction) Execute(inputParams InputParams, outputWriter io.Writer) error

func (*DashboardUrlAction) IsImplemented added in v0.22.0

func (d *DashboardUrlAction) IsImplemented() bool

func (*DashboardUrlAction) ParseArgs added in v0.22.0

func (d *DashboardUrlAction) ParseArgs(reader io.Reader, args []string) (InputParams, error)

type DashboardUrlGenerator

type DashboardUrlGenerator interface {
	DashboardUrl(params DashboardUrlParams) (DashboardUrl, error)
}

type DashboardUrlJSONParams added in v0.26.0

type DashboardUrlJSONParams struct {
	InstanceId string `json:"instance_id"`
	Plan       string `json:"plan"`
	Manifest   string `json:"manifest"`
}

type DashboardUrlParams added in v0.22.0

type DashboardUrlParams struct {
	InstanceID string
	Plan       Plan
	Manifest   bosh.BoshManifest
}

type DeleteBindingAction added in v0.22.0

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

func NewDeleteBindingAction added in v0.22.0

func NewDeleteBindingAction(unbinder Binder) *DeleteBindingAction

func (*DeleteBindingAction) Execute added in v0.22.0

func (d *DeleteBindingAction) Execute(inputParams InputParams, outputWriter io.Writer) error

func (*DeleteBindingAction) IsImplemented added in v0.22.0

func (d *DeleteBindingAction) IsImplemented() bool

func (*DeleteBindingAction) ParseArgs added in v0.22.0

func (d *DeleteBindingAction) ParseArgs(reader io.Reader, args []string) (InputParams, error)

type DeleteBindingJSONParams added in v0.26.0

type DeleteBindingJSONParams struct {
	BindingId         string `json:"binding_id"`
	BoshVms           string `json:"bosh_vms"`
	Manifest          string `json:"manifest"`
	RequestParameters string `json:"request_parameters"`
	Secrets           string `json:"secrets"`
	DNSAddresses      string `json:"dns_addresses"`
}

type DeleteBindingParams added in v0.22.0

type DeleteBindingParams struct {
	BindingID          string
	DeploymentTopology bosh.BoshVMs
	Manifest           bosh.BoshManifest
	RequestParams      RequestParameters
	Secrets            ManifestSecrets
	DNSAddresses       DNSAddresses
}

type Errand added in v0.19.0

type Errand struct {
	Name      string   `json:"name,omitempty"`
	Instances []string `json:"instances,omitempty"`
}

type GenerateManifestAction added in v0.22.0

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

func NewGenerateManifestAction added in v0.22.0

func NewGenerateManifestAction(manifestGenerator ManifestGenerator) *GenerateManifestAction

func (*GenerateManifestAction) Execute added in v0.22.0

func (g *GenerateManifestAction) Execute(inputParams InputParams, outputWriter io.Writer) (err error)

func (*GenerateManifestAction) IsImplemented added in v0.22.0

func (g *GenerateManifestAction) IsImplemented() bool

func (*GenerateManifestAction) ParseArgs added in v0.22.0

func (g *GenerateManifestAction) ParseArgs(reader io.Reader, args []string) (InputParams, error)

type GenerateManifestJSONParams added in v0.26.0

type GenerateManifestJSONParams struct {
	ServiceDeployment        string `json:"service_deployment"`
	Plan                     string `json:"plan"`
	PreviousPlan             string `json:"previous_plan"`
	PreviousManifest         string `json:"previous_manifest"`
	RequestParameters        string `json:"request_parameters"`
	PreviousSecrets          string `json:"previous_secrets"`
	PreviousConfigs          string `json:"previous_configs"`
	ServiceInstanceUAAClient string `json:"uaa_client"`
}

type GenerateManifestOutput added in v0.22.0

type GenerateManifestOutput struct {
	Manifest          bosh.BoshManifest `json:"manifest"`
	ODBManagedSecrets ODBManagedSecrets `json:"secrets"`
	Configs           BOSHConfigs       `json:"configs"`
}

type GenerateManifestParams added in v0.22.0

type GenerateManifestParams struct {
	ServiceDeployment        ServiceDeployment
	Plan                     Plan
	RequestParams            RequestParameters
	PreviousManifest         *bosh.BoshManifest
	PreviousPlan             *Plan
	PreviousSecrets          ManifestSecrets
	PreviousConfigs          BOSHConfigs
	ServiceInstanceUAAClient *ServiceInstanceUAAClient
}

type GeneratePlanSchemaParams added in v0.26.0

type GeneratePlanSchemaParams struct {
	Plan Plan
}

type GeneratePlanSchemasAction added in v0.22.0

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

func NewGeneratePlanSchemasAction added in v0.22.0

func NewGeneratePlanSchemasAction(schemaGenerator SchemaGenerator, errorWriter io.Writer) *GeneratePlanSchemasAction

func (*GeneratePlanSchemasAction) Execute added in v0.22.0

func (g *GeneratePlanSchemasAction) Execute(inputParams InputParams, outputWriter io.Writer) (err error)

func (*GeneratePlanSchemasAction) IsImplemented added in v0.22.0

func (g *GeneratePlanSchemasAction) IsImplemented() bool

func (*GeneratePlanSchemasAction) ParseArgs added in v0.22.0

func (g *GeneratePlanSchemasAction) ParseArgs(reader io.Reader, args []string) (InputParams, error)

type GeneratePlanSchemasJSONParams added in v0.26.0

type GeneratePlanSchemasJSONParams struct {
	Plan string `json:"plan"`
}

type InputParams added in v0.22.0

type InputParams struct {
	GenerateManifest    GenerateManifestJSONParams    `json:"generate_manifest,omitempty"`
	DashboardUrl        DashboardUrlJSONParams        `json:"dashboard_url,omitempty"`
	CreateBinding       CreateBindingJSONParams       `json:"create_binding,omitempty"`
	DeleteBinding       DeleteBindingJSONParams       `json:"delete_binding,omitempty"`
	GeneratePlanSchemas GeneratePlanSchemasJSONParams `json:"generate_plan_schemas,omitempty"`
	TextOutput          bool                          `json:"-"`
}

type InstanceGroup

type InstanceGroup struct {
	Name               string       `json:"name" validate:"required"`
	VMType             string       `yaml:"vm_type" json:"vm_type" validate:"required"`
	VMExtensions       VMExtensions `yaml:"vm_extensions,omitempty" json:"vm_extensions,omitempty"`
	PersistentDiskType string       `yaml:"persistent_disk_type,omitempty" json:"persistent_disk_type,omitempty"`
	Instances          int          `json:"instances" validate:"min=1"`
	Networks           []string     `json:"networks" validate:"required"`
	AZs                []string     `json:"azs" validate:"required,min=1"`
	Lifecycle          string       `yaml:"lifecycle,omitempty" json:"lifecycle,omitempty"`
	MigratedFrom       []Migration  `yaml:"migrated_from,omitempty" json:"migrated_from,omitempty"`
}

func (*InstanceGroup) UnmarshalYAML

func (i *InstanceGroup) UnmarshalYAML(unmarshal func(interface{}) error) error

type JSONSchemas added in v0.21.0

type JSONSchemas struct {
	Parameters map[string]interface{} `json:"parameters"`
}

type LifecycleErrands added in v0.19.0

type LifecycleErrands struct {
	PostDeploy []Errand `json:"post_deploy,omitempty" yaml:"post_deploy,omitempty"`
	PreDelete  []Errand `json:"pre_delete,omitempty" yaml:"pre_delete,omitempty"`
}

type ManifestGenerator

type ManifestGenerator interface {
	GenerateManifest(params GenerateManifestParams) (GenerateManifestOutput, error)
}

type ManifestSecrets added in v0.22.0

type ManifestSecrets map[string]string

type MarshalledGenerateManifest added in v0.22.0

type MarshalledGenerateManifest struct {
	Manifest          string            `json:"manifest"`
	ODBManagedSecrets ODBManagedSecrets `json:"secrets"`
	Configs           BOSHConfigs       `json:"configs"`
}

type Migration added in v0.17.0

type Migration struct {
	Name string `yaml:"name" json:"name"`
}

type MissingArgsError added in v0.22.0

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

func NewMissingArgsError added in v0.22.0

func NewMissingArgsError(e string) MissingArgsError

type ODBManagedSecrets added in v0.22.0

type ODBManagedSecrets map[string]interface{}

type Plan

type Plan struct {
	Properties       Properties       `json:"properties"`
	LifecycleErrands LifecycleErrands `json:"lifecycle_errands,omitempty" yaml:"lifecycle_errands"`
	InstanceGroups   []InstanceGroup  `json:"instance_groups" validate:"required,dive" yaml:"instance_groups"`
	Update           *Update          `json:"update,omitempty"`
}

func (Plan) Validate

func (p Plan) Validate() error

type PlanSchema added in v0.21.0

type PlanSchema struct {
	ServiceInstance ServiceInstanceSchema `json:"service_instance"`
	ServiceBinding  ServiceBindingSchema  `json:"service_binding"`
}

type Properties

type Properties map[string]interface{}

type RequestParameters

type RequestParameters map[string]interface{}

func (RequestParameters) ArbitraryContext added in v0.20.0

func (s RequestParameters) ArbitraryContext() map[string]interface{}

func (RequestParameters) ArbitraryParams

func (s RequestParameters) ArbitraryParams() map[string]interface{}

func (RequestParameters) BindResource added in v0.19.0

func (s RequestParameters) BindResource() domain.BindResource

func (RequestParameters) Platform added in v0.20.0

func (s RequestParameters) Platform() string

type SchemaGenerator added in v0.21.0

type SchemaGenerator interface {
	GeneratePlanSchema(params GeneratePlanSchemaParams) (PlanSchema, error)
}

type ServiceBindingSchema added in v0.21.0

type ServiceBindingSchema struct {
	Create JSONSchemas `json:"create"`
}

type ServiceDeployment

type ServiceDeployment struct {
	DeploymentName string          `json:"deployment_name" validate:"required"`
	Releases       ServiceReleases `json:"releases" validate:"required"`
	Stemcells      []Stemcell      `json:"stemcells" validate:"required"`
}

func (ServiceDeployment) Validate

func (s ServiceDeployment) Validate() error

type ServiceInstanceSchema added in v0.21.0

type ServiceInstanceSchema struct {
	Create JSONSchemas `json:"create"`
	Update JSONSchemas `json:"update"`
}

type ServiceInstanceUAAClient added in v0.40.0

type ServiceInstanceUAAClient struct {
	Authorities          string `json:"authorities"`
	AuthorizedGrantTypes string `json:"authorized_grant_types"`
	ClientID             string `json:"client_id"`
	ClientSecret         string `json:"client_secret"`
	Name                 string `json:"name"`
	ResourceIDs          string `json:"resource_ids"`
	Scopes               string `json:"scopes"`
}

type ServiceRelease

type ServiceRelease struct {
	Name    string   `json:"name" validate:"required"`
	Version string   `json:"version" validate:"required"`
	Jobs    []string `json:"jobs" validate:"required,min=1"`
}

func FindReleaseForJob added in v0.17.2

func FindReleaseForJob(jobName string, releases ServiceReleases) (ServiceRelease, error)

type ServiceReleases

type ServiceReleases []ServiceRelease

func (ServiceReleases) Validate

func (r ServiceReleases) Validate() error

type Stemcell

type Stemcell struct {
	OS      string `json:"stemcell_os" validate:"required"`
	Version string `json:"stemcell_version" validate:"required"`
}

type Update

type Update struct {
	Canaries                      int                   `json:"canaries" yaml:"canaries"`
	CanaryWatchTime               string                `json:"canary_watch_time" yaml:"canary_watch_time"`
	UpdateWatchTime               string                `json:"update_watch_time" yaml:"update_watch_time"`
	MaxInFlight                   bosh.MaxInFlightValue `json:"max_in_flight," yaml:"max_in_flight"`
	Serial                        *bool                 `json:"serial,omitempty" yaml:"serial,omitempty"`
	InitialDeployAZUpdateStrategy bosh.UpdateStrategy   `json:"initial_deploy_az_update_strategy,omitempty" yaml:"initial_deploy_az_update_strategy,omitempty"`
}

func (*Update) MarshalJSON added in v0.20.0

func (u *Update) MarshalJSON() ([]byte, error)

func (*Update) MarshalYAML added in v0.20.0

func (u *Update) MarshalYAML() (interface{}, error)

func (*Update) UnmarshalJSON added in v0.20.0

func (u *Update) UnmarshalJSON(data []byte) error

func (*Update) UnmarshalYAML added in v0.20.0

func (u *Update) UnmarshalYAML(unmarshal func(interface{}) error) error

type VMExtensions

type VMExtensions []string

func (*VMExtensions) UnmarshalYAML

func (e *VMExtensions) UnmarshalYAML(unmarshal func(interface{}) error) error

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