func (cmd ListServiceBrokers) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) != 0 { cmd.ui.FailWithUsage(c) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd *Push) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { var reqs []requirements.Requirement usageReq := requirementsFactory.NewUsageRequirement(commandregistry.CLICommandUsagePresenter(cmd), "", func() bool { return len(fc.Args()) > 1 }, ) reqs = append(reqs, usageReq) if fc.String("route-path") != "" { reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--route-path'", cf.RoutePathMinimumAPIVersion)) } if fc.String("app-ports") != "" { reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--app-ports'", cf.MultipleAppPortsMinimumAPIVersion)) } reqs = append(reqs, []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), requirementsFactory.NewTargetedSpaceRequirement(), }...) return reqs, nil }
func (cmd *Password) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { reqs := []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), } return reqs, nil }
func (cmd *ShowSecurityGroup) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 1 { cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + command_registry.Commands.CommandUsage("security-group")) } return []requirements.Requirement{requirementsFactory.NewLoginRequirement()}, nil }
func (cmd ListServices) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { reqs = append(reqs, requirementsFactory.NewLoginRequirement(), requirementsFactory.NewTargetedSpaceRequirement(), ) return }
func (cmd *UnmapRoute) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires app_name, domain_name as arguments\n\n") + commandregistry.Commands.CommandUsage("unmap-route")) return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 2) } if fc.IsSet("port") && (fc.IsSet("hostname") || fc.IsSet("path")) { cmd.ui.Failed(T("Cannot specify port together with hostname and/or path.")) return nil, fmt.Errorf("Cannot specify port together with hostname and/or path.") } domainName := fc.Args()[1] cmd.appReq = requirementsFactory.NewApplicationRequirement(fc.Args()[0]) cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName) var reqs []requirements.Requirement if fc.String("path") != "" { reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--path'", cf.RoutePathMinimumAPIVersion)) } if fc.IsSet("port") { reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--port'", cf.TCPRoutingMinimumAPIVersion)) } reqs = append(reqs, []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), cmd.appReq, cmd.domainReq, }...) return reqs, nil }
func (cmd *OAuthToken) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) []requirements.Requirement { reqs := []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), } return reqs }
func (cmd *EnableServiceAccess) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 1 { cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + command_registry.Commands.CommandUsage("enable-service-access")) } return []requirements.Requirement{requirementsFactory.NewLoginRequirement()}, nil }
func (cmd *Restage) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) != 1 { cmd.ui.FailWithUsage(c) } return []requirements.Requirement{requirementsFactory.NewLoginRequirement()}, nil }
func (cmd *EnableServiceAccess) GetRequirements(requirementsFactory requirements.Factory, context *cli.Context) ([]requirements.Requirement, error) { if len(context.Args()) != 1 { cmd.ui.FailWithUsage(context) } return []requirements.Requirement{requirementsFactory.NewLoginRequirement()}, nil }
func (cmd *ListSpaceQuotas) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { reqs = []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), requirementsFactory.NewTargetedOrgRequirement(), } return }
func (cmd *CreateRoute) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires SPACE and DOMAIN as arguments\n\n") + command_registry.Commands.CommandUsage("create-route")) } domainName := fc.Args()[1] cmd.spaceReq = requirementsFactory.NewSpaceRequirement(fc.Args()[0]) cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName) requiredVersion, err := semver.Make("2.36.0") if err != nil { panic(err.Error()) } var reqs []requirements.Requirement if fc.String("path") != "" { reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--path'", requiredVersion)) } reqs = append(reqs, []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), requirementsFactory.NewTargetedOrgRequirement(), cmd.spaceReq, cmd.domainReq, }...) return reqs, nil }
func (cmd DeleteOrphanedRoutes) GetRequirements(reqFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) != 0 { cmd.ui.FailWithUsage(c) } reqs = append(reqs, reqFactory.NewLoginRequirement()) return }
func (cmd CreateSecurityGroup) GetRequirements(requirementsFactory requirements.Factory, context *cli.Context) ([]requirements.Requirement, error) { if len(context.Args()) != 1 { cmd.ui.FailWithUsage(context) } requirements := []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return requirements, nil }
func (cmd AssignSecurityGroup) GetRequirements(requirementsFactory requirements.Factory, context *cli.Context) (reqs []requirements.Requirement, err error) { if len(context.Args()) != 3 { cmd.ui.FailWithUsage(context) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd *RenameBuildpack) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires BUILDPACK_NAME, NEW_BUILDPACK_NAME as arguments\n\n") + command_registry.Commands.CommandUsage("rename-buildpack")) } reqs = []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return }
func (cmd *CreateSecurityGroup) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires SECURITY_GROUP and PATH_TO_JSON_RULES_FILE as arguments\n\n") + command_registry.Commands.CommandUsage("create-security-group")) } requirements := []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return requirements, nil }
func (cmd *PurgeServiceOffering) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 1 { cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + command_registry.Commands.CommandUsage("purge-service-offering")) } reqs = []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return }
func (cmd CreateUserProvidedService) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) != 1 { cmd.ui.FailWithUsage(c) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd Authenticate) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) != 2 { cmd.ui.FailWithUsage(c) } reqs = append(reqs, requirementsFactory.NewApiEndpointRequirement()) return }
func (cmd *listStagingSecurityGroups) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 0 { cmd.ui.Failed(T("Incorrect Usage. No argument required\n\n") + command_registry.Commands.CommandUsage("staging-security-groups")) } requirements := []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return requirements, nil }
func (cmd *ListStacks) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 0 { cmd.ui.Failed(T("Incorrect Usage. Requires app name as argument\n\n") + command_registry.Commands.CommandUsage("stacks")) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd *RenameBuildpack) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) != 2 { cmd.ui.FailWithUsage(c) } reqs = []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return }
func (cmd *OneTimeSSHCode) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 0 { cmd.ui.Failed(T("Incorrect Usage. No argument required\n\n") + command_registry.Commands.CommandUsage("ssh-code")) } reqs := append([]requirements.Requirement{}, requirementsFactory.NewApiEndpointRequirement()) return reqs, nil }
func (cmd *RenameServiceBroker) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires SERVICE_BROKER, NEW_SERVICE_BROKER as arguments\n\n") + command_registry.Commands.CommandUsage("rename-service-broker")) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd *Authenticate) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires 'username password' as arguments\n\n") + command_registry.Commands.CommandUsage("auth")) } reqs = append(reqs, requirementsFactory.NewApiEndpointRequirement()) return }
func (cmd listDefaultStagingSecurityGroups) GetRequirements(requirementsFactory requirements.Factory, context *cli.Context) ([]requirements.Requirement, error) { if len(context.Args()) != 0 { cmd.ui.FailWithUsage(context) } requirements := []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return requirements, nil }
func (cmd *DeleteServiceBroker) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 1 { cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + command_registry.Commands.CommandUsage("delete-service-broker")) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd *DeleteOrphanedRoutes) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) { if len(fc.Args()) != 0 { cmd.ui.Failed(T("Incorrect Usage. No argument required\n\n") + command_registry.Commands.CommandUsage("delete-orphaned-routes")) } reqs = append(reqs, requirementsFactory.NewLoginRequirement()) return }
func (cmd *DeleteApp) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { if len(c.Args()) == 0 { cmd.ui.FailWithUsage(c) } reqs = []requirements.Requirement{requirementsFactory.NewLoginRequirement()} return }