Documentation ¶
Overview ¶
Package selector provides functionality for users to select an application, environment, or service name.
Package selector provides functionality for users to select an application, environment, or service name.
Index ¶
- Constants
- Variables
- func AskCustomPaths(prompter Prompter, customPathPrompt, customPathHelp string, ...) ([]string, error)
- func NewDockerfileSelector(prompt Prompter, fs afero.Fs) (*dockerfileSelector, error)
- func NewLocalFileSelector(prompt Prompter, fs afero.Fs, ws *workspace.Workspace) (*localFileSelector, error)
- func NewStaticSelector(prompt Prompter) *staticSelector
- type AppEnvSelector
- func (s *AppEnvSelector) Application(msg, help string, additionalOpts ...string) (string, error)
- func (s *AppEnvSelector) Environment(msg, help, app string, additionalOpts ...prompt.Option) (string, error)
- func (s *AppEnvSelector) Environments(prompt, help, app string, finalMsgFunc func(int) prompt.PromptConfig) ([]string, error)
- type AppPipelineSelector
- type CFNSelector
- type CFTaskSelector
- type CodePipelineSelector
- type ConfigSelector
- type CredsSelect
- type DeploySelector
- func (s *DeploySelector) DeployedJob(msg, help string, app string, opts ...GetDeployedWorkloadOpts) (*DeployedJob, error)
- func (s *DeploySelector) DeployedService(msg, help string, app string, opts ...GetDeployedWorkloadOpts) (*DeployedService, error)
- func (s *DeploySelector) DeployedWorkload(msg, help string, app string, opts ...GetDeployedWorkloadOpts) (*DeployedWorkload, error)
- func (s *DeploySelector) Topics(promptMsg, help, app string) ([]deploy.Topic, error)
- type DeployedJob
- type DeployedService
- type DeployedWorkload
- type DeployedWorkloadFilter
- type EC2Select
- type GetDeployedTaskOpts
- type GetDeployedWorkloadOpts
- type LocalEnvironmentSelector
- type LocalWorkloadSelector
- func (s *LocalWorkloadSelector) Job(msg, help string) (string, error)
- func (s *LocalWorkloadSelector) Service(msg, help string) (string, error)
- func (s *LocalWorkloadSelector) Workload(msg, help string) (wl string, err error)
- func (s *LocalWorkloadSelector) Workloads(msg, help string) ([]string, error)
- type Names
- type Prompter
- type SessionProvider
- type SubnetsInput
- type TaskOpts
- type TaskSelector
- type VPCSubnetLister
- type WorkloadSelectOption
- type WorkspaceSelector
- type WsPipelineSelector
Constants ¶
const (
// DockerfilePromptUseImage is the option for using existing image instead of Dockerfile.
DockerfilePromptUseImage = "Use an existing image instead"
)
Variables ¶
var ( // ErrLocalEnvsNotFound is returned when there are no environment manifests in the workspace. ErrLocalEnvsNotFound = errors.New("no environments found") // ErrVPCNotFound is returned when no existing VPCs are found. ErrVPCNotFound = errors.New("no existing VPCs found") // ErrSubnetsNotFound is returned when no existing subnets are found. ErrSubnetsNotFound = errors.New("no existing subnets found") )
Functions ¶
func AskCustomPaths ¶ added in v1.28.0
func AskCustomPaths(prompter Prompter, customPathPrompt, customPathHelp string, pathValidator prompt.ValidatorFunc) ([]string, error)
AskCustomPaths prompts for user input of filepaths, which are then validated.
func NewDockerfileSelector ¶ added in v1.28.0
NewDockerfileSelector constructs a DockerfileSelector.
func NewLocalFileSelector ¶ added in v1.24.0
func NewLocalFileSelector(prompt Prompter, fs afero.Fs, ws *workspace.Workspace) (*localFileSelector, error)
NewLocalFileSelector constructs a LocalFileSelector.
func NewStaticSelector ¶ added in v1.24.0
func NewStaticSelector(prompt Prompter) *staticSelector
NewStaticSelector constructs a staticSelector.
Types ¶
type AppEnvSelector ¶ added in v1.19.0
type AppEnvSelector struct {
// contains filtered or unexported fields
}
AppEnvSelector prompts users to select the name of an application or environment.
func NewAppEnvSelector ¶ added in v1.19.0
func NewAppEnvSelector(prompt Prompter, store appEnvLister) *AppEnvSelector
NewAppEnvSelector returns a selector that chooses applications or environments.
func (*AppEnvSelector) Application ¶ added in v1.19.0
func (s *AppEnvSelector) Application(msg, help string, additionalOpts ...string) (string, error)
Application fetches all the apps in an account/region and prompts the user to select one.
func (*AppEnvSelector) Environment ¶ added in v1.19.0
func (s *AppEnvSelector) Environment(msg, help, app string, additionalOpts ...prompt.Option) (string, error)
Environment fetches all the environments in an app and prompts the user to select one.
func (*AppEnvSelector) Environments ¶ added in v1.19.0
func (s *AppEnvSelector) Environments(prompt, help, app string, finalMsgFunc func(int) prompt.PromptConfig) ([]string, error)
Environments fetches all the environments in an app and prompts the user to select one OR MORE. The List of options decreases as envs are chosen. Chosen envs displayed above with the finalMsg.
type AppPipelineSelector ¶ added in v1.19.0
type AppPipelineSelector struct { *AppEnvSelector *CodePipelineSelector }
AppPipelineSelector is a selector for deployed pipelines and apps.
func NewAppPipelineSelector ¶ added in v1.19.0
func NewAppPipelineSelector(prompt Prompter, store configLister, lister codePipelineLister) *AppPipelineSelector
NewAppPipelineSelector returns new selectors with deployed pipelines and apps.
type CFNSelector ¶ added in v1.27.0
type CFNSelector struct {
// contains filtered or unexported fields
}
CFNSelector represents a selector for a CloudFormation template.
func NewCFNSelector ¶ added in v1.27.0
func NewCFNSelector(prompt Prompter) *CFNSelector
NewCFNSelector initializes a CFNSelector.
func (*CFNSelector) Resources ¶ added in v1.27.0
func (sel *CFNSelector) Resources(msg, finalMsg, help, body string) ([]template.CFNResource, error)
Resources prompts the user to multiselect resources from a CloudFormation template body. By default, the prompt filters out any custom resource in the template.
type CFTaskSelector ¶ added in v1.19.0
type CFTaskSelector struct { *AppEnvSelector // contains filtered or unexported fields }
CFTaskSelector is a selector based on CF methods to get deployed one off tasks.
func NewCFTaskSelect ¶ added in v1.1.0
func NewCFTaskSelect(prompt Prompter, store configLister, cf taskStackDescriber) *CFTaskSelector
NewCFTaskSelect constructs a CFTaskSelector.
func (*CFTaskSelector) Task ¶ added in v1.19.0
func (s *CFTaskSelector) Task(msg, help string, opts ...GetDeployedTaskOpts) (string, error)
Task has the user select a task. Callers can provide an environment, an app, or a "use default cluster" option to filter the returned tasks.
type CodePipelineSelector ¶ added in v1.19.0
type CodePipelineSelector struct {
// contains filtered or unexported fields
}
CodePipelineSelector is a selector for deployed pipelines.
func (*CodePipelineSelector) DeployedPipeline ¶ added in v1.19.0
func (s *CodePipelineSelector) DeployedPipeline(msg, help, app string) (deploy.Pipeline, error)
DeployedPipeline fetches all the pipelines in a workspace and prompts the user to select one.
type ConfigSelector ¶ added in v1.19.0
type ConfigSelector struct { *AppEnvSelector // contains filtered or unexported fields }
ConfigSelector is an application and environment selector, but can also choose a service from the config store.
func NewConfigSelector ¶ added in v1.19.0
func NewConfigSelector(prompt Prompter, store configLister) *ConfigSelector
NewConfigSelector returns a new selector that chooses applications, environments, or services from the config store.
func (*ConfigSelector) Job ¶ added in v1.19.0
func (s *ConfigSelector) Job(msg, help, app string) (string, error)
Job fetches all jobs in an app and prompts the user to select one.
type CredsSelect ¶ added in v0.3.0
type CredsSelect struct { Prompt Prompter Profile Names Session SessionProvider }
CredsSelect prompts users for credentials.
type DeploySelector ¶ added in v1.19.0
type DeploySelector struct { *ConfigSelector // contains filtered or unexported fields }
DeploySelector is a service and environment selector from the deploy store.
func NewDeploySelect ¶
func NewDeploySelect(prompt Prompter, configStore configLister, deployStore deployedWorkloadsRetriever) *DeploySelector
NewDeploySelect returns a new selector that chooses services and environments from the deploy store.
func (*DeploySelector) DeployedJob ¶ added in v1.20.0
func (s *DeploySelector) DeployedJob(msg, help string, app string, opts ...GetDeployedWorkloadOpts) (*DeployedJob, error)
DeployedJob has the user select a deployed job. Callers can provide either a particular environment, a particular job to filter on, or both.
func (*DeploySelector) DeployedService ¶ added in v1.19.0
func (s *DeploySelector) DeployedService(msg, help string, app string, opts ...GetDeployedWorkloadOpts) (*DeployedService, error)
DeployedService has the user select a deployed service. Callers can provide either a particular environment, a particular service to filter on, or both.
func (*DeploySelector) DeployedWorkload ¶ added in v1.29.1
func (s *DeploySelector) DeployedWorkload(msg, help string, app string, opts ...GetDeployedWorkloadOpts) (*DeployedWorkload, error)
DeployedWorkload has the user select a deployed workload. Callers can provide either a particular environment, a particular workload to filter on, or both.
type DeployedJob ¶ added in v1.20.0
DeployedJob contains the name and environment of the deployed job.
func (*DeployedJob) String ¶ added in v1.20.0
func (j *DeployedJob) String() string
String returns a string representation of the job's name and environment.
type DeployedService ¶
DeployedService contains the name and environment of the deployed service.
func (*DeployedService) String ¶
func (s *DeployedService) String() string
String returns a string representation of the service's name and environment.
type DeployedWorkload ¶ added in v1.20.0
DeployedWorkload contains the name and environment name of the deployed workload.
func (*DeployedWorkload) String ¶ added in v1.20.0
func (w *DeployedWorkload) String() string
String returns a string representation of the workload's name and environment.
type DeployedWorkloadFilter ¶ added in v1.20.0
type DeployedWorkloadFilter func(*DeployedWorkload) (bool, error)
DeployedWorkloadFilter determines if a service or job should be included in the results.
type EC2Select ¶ added in v0.3.0
type EC2Select struct {
// contains filtered or unexported fields
}
EC2Select is a selector for Ec2 resources.
func NewEC2Select ¶ added in v0.3.0
func NewEC2Select(prompt Prompter, ec2Client VPCSubnetLister) *EC2Select
NewEC2Select returns a new selector that chooses Ec2 resources.
type GetDeployedTaskOpts ¶ added in v1.1.0
type GetDeployedTaskOpts func(*CFTaskSelector)
GetDeployedTaskOpts sets up optional parameters for GetDeployedTaskOpts function.
func TaskWithAppEnv ¶ added in v1.1.0
func TaskWithAppEnv(app, env string) GetDeployedTaskOpts
TaskWithAppEnv sets up the env name for TaskSelector.
func TaskWithDefaultCluster ¶ added in v1.1.0
func TaskWithDefaultCluster() GetDeployedTaskOpts
TaskWithDefaultCluster sets up whether CFTaskSelector should use only the default cluster.
type GetDeployedWorkloadOpts ¶ added in v1.20.0
type GetDeployedWorkloadOpts func(*DeploySelector)
GetDeployedWorkloadOpts sets up optional parameters for GetDeployedWorkloadOpts function.
func WithEnv ¶
func WithEnv(env string) GetDeployedWorkloadOpts
WithEnv sets up the env name for DeploySelector.
func WithName ¶ added in v1.20.0
func WithName(name string) GetDeployedWorkloadOpts
WithName sets up the wkld name for DeploySelector.
func WithServiceTypesFilter ¶ added in v1.7.0
func WithServiceTypesFilter(svcTypes []string) GetDeployedWorkloadOpts
WithServiceTypesFilter sets up a ServiceType filter for DeploySelector
func WithWkldFilter ¶ added in v1.20.0
func WithWkldFilter(filter DeployedWorkloadFilter) GetDeployedWorkloadOpts
WithWkldFilter sets up filters for DeploySelector
type LocalEnvironmentSelector ¶ added in v1.19.0
type LocalEnvironmentSelector struct { *AppEnvSelector // contains filtered or unexported fields }
LocalEnvironmentSelector is an application and environment selector, but can also choose an environment from the workspace.
func NewLocalEnvironmentSelector ¶ added in v1.20.0
func NewLocalEnvironmentSelector(prompt Prompter, store configLister, ws workspaceRetriever) *LocalEnvironmentSelector
NewLocalEnvironmentSelector returns a new selector that chooses applications from the config store, but an environment from the local workspace.
func (*LocalEnvironmentSelector) LocalEnvironment ¶ added in v1.19.0
func (s *LocalEnvironmentSelector) LocalEnvironment(msg, help string) (string, error)
LocalEnvironment fetches all environments belong to the app in the workspace and prompts the user to select one.
type LocalWorkloadSelector ¶ added in v1.19.0
type LocalWorkloadSelector struct { *ConfigSelector // contains filtered or unexported fields }
LocalWorkloadSelector is an application and environment selector, but can also choose a service from the workspace.
func NewLocalWorkloadSelector ¶ added in v1.19.0
func NewLocalWorkloadSelector(prompt Prompter, store configLister, ws workspaceRetriever, options ...WorkloadSelectOption) *LocalWorkloadSelector
NewLocalWorkloadSelector returns a new selector that chooses applications and environments from the config store, but services from the local workspace.
func (*LocalWorkloadSelector) Job ¶ added in v1.19.0
func (s *LocalWorkloadSelector) Job(msg, help string) (string, error)
Job fetches all jobs in the workspace and then prompts the user to select one.
func (*LocalWorkloadSelector) Service ¶ added in v1.19.0
func (s *LocalWorkloadSelector) Service(msg, help string) (string, error)
Service fetches all services in the workspace and then prompts the user to select one.
func (*LocalWorkloadSelector) Workload ¶ added in v1.19.0
func (s *LocalWorkloadSelector) Workload(msg, help string) (wl string, err error)
Workload fetches all jobs and services in a workspace and prompts the user to select one. It can optionally select only initialized workloads which exist in the app (by passing the OnlyInitializedWorkloads option to NewLocalWorkloadSelector) or list all workloads for which there are manifests in the workspace (default).
func (*LocalWorkloadSelector) Workloads ¶ added in v1.31.0
func (s *LocalWorkloadSelector) Workloads(msg, help string) ([]string, error)
Workloads fetches all jobs and services in a workspace and prompts the user to select one or more. It can optionally select only initialized workloads which exist in the app (by passing the OnlyInitializedWorkloads option to NewLocalWorkloadSelector) or list all workloads for which there are manifests in the workspace (default).
type Names ¶ added in v0.3.0
type Names interface {
Names() []string
}
Names wraps the method that returns a list of names.
type Prompter ¶
type Prompter interface { Get(message, help string, validator prompt.ValidatorFunc, promptOpts ...prompt.PromptConfig) (string, error) SelectOne(message, help string, options []string, promptOpts ...prompt.PromptConfig) (string, error) SelectOption(message, help string, opts []prompt.Option, promptCfgs ...prompt.PromptConfig) (value string, err error) MultiSelectOptions(message, help string, opts []prompt.Option, promptCfgs ...prompt.PromptConfig) ([]string, error) MultiSelect(message, help string, options []string, validator prompt.ValidatorFunc, promptOpts ...prompt.PromptConfig) ([]string, error) Confirm(message, help string, promptOpts ...prompt.PromptConfig) (bool, error) }
Prompter wraps the methods to ask for inputs from the terminal.
type SessionProvider ¶ added in v0.3.0
type SessionProvider interface { Default() (*session.Session, error) FromProfile(name string) (*session.Session, error) FromStaticCreds(accessKeyID, secretAccessKey, sessionToken string) (*session.Session, error) }
SessionProvider wraps the methods to create AWS sessions.
type SubnetsInput ¶ added in v1.11.0
SubnetsInput holds the arguments for the subnet selector.
type TaskOpts ¶ added in v1.1.0
type TaskOpts func(*TaskSelector)
TaskOpts sets up optional parameters for Task function.
func WithAppEnv ¶ added in v1.1.0
WithAppEnv sets up the app name and env name for TaskSelector.
func WithDefault ¶ added in v1.1.0
func WithDefault() TaskOpts
WithDefault uses default cluster for TaskSelector.
func WithTaskGroup ¶ added in v1.1.0
WithTaskGroup sets up the task group name for TaskSelector.
func WithTaskID ¶ added in v1.1.0
WithTaskID sets up the task ID for TaskSelector.
type TaskSelector ¶ added in v1.19.0
type TaskSelector struct {
// contains filtered or unexported fields
}
TaskSelector is a Copilot running task selector.
func NewTaskSelector ¶ added in v1.19.0
func NewTaskSelector(prompt Prompter, lister taskLister) *TaskSelector
NewTaskSelector returns a new selector that chooses a running task.
func (*TaskSelector) RunningTask ¶ added in v1.19.0
RunningTask has the user select a running task. Callers can provide either app and env names, or use default cluster.
type VPCSubnetLister ¶ added in v0.3.0
type VPCSubnetLister interface { ListVPCs() ([]ec2.VPC, error) ListVPCSubnets(vpcID string) (*ec2.VPCSubnets, error) }
VPCSubnetLister list VPCs and subnets.
type WorkloadSelectOption ¶ added in v1.30.0
type WorkloadSelectOption func(selector *LocalWorkloadSelector)
WorkloadSelectOption represents an option for customizing LocalWorkloadSelector's behavior.
var OnlyInitializedWorkloads WorkloadSelectOption = func(s *LocalWorkloadSelector) { s.onlyInitializedWorkloads = true }
OnlyInitializedWorkloads modifies LocalWorkloadSelector to show only the initialized workloads in the workspace, ignoring uninitialized workloads with local manifests.
type WorkspaceSelector ¶ added in v1.19.0
type WorkspaceSelector struct { *ConfigSelector // contains filtered or unexported fields }
WorkspaceSelector selects from local workspace.
func NewWorkspaceSelector ¶ added in v1.19.0
func NewWorkspaceSelector(prompt Prompter, ws workspaceRetriever) *WorkspaceSelector
NewWorkspaceSelector returns a new selector that prompts for local information.
type WsPipelineSelector ¶ added in v1.19.0
type WsPipelineSelector struct {
// contains filtered or unexported fields
}
WsPipelineSelector is a workspace pipeline selector.
func NewWsPipelineSelector ¶ added in v1.19.0
func NewWsPipelineSelector(prompt Prompter, ws wsPipelinesLister) *WsPipelineSelector
NewWsPipelineSelector returns a new selector with pipelines from the local workspace.
func (*WsPipelineSelector) WsPipeline ¶ added in v1.19.0
func (s *WsPipelineSelector) WsPipeline(msg, help string) (*workspace.PipelineManifest, error)
WsPipeline fetches all the pipelines in a workspace and prompts the user to select one.