本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/requirements.Factory.NewMinAPIVersionRequirement方法的典型用法代碼示例。如果您正苦於以下問題:Golang Factory.NewMinAPIVersionRequirement方法的具體用法?Golang Factory.NewMinAPIVersionRequirement怎麽用?Golang Factory.NewMinAPIVersionRequirement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/cloudfoundry/org/cli/cf/requirements.Factory
的用法示例。
在下文中一共展示了Factory.NewMinAPIVersionRequirement方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Requirements
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
}
示例2: Requirements
func (cmd *BindRouteService) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 2 {
cmd.ui.Failed(T("Incorrect Usage. Requires DOMAIN and SERVICE_INSTANCE as arguments\n\n") + commandregistry.Commands.CommandUsage("bind-route-service"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 2)
}
domainName := fc.Args()[0]
cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName)
serviceName := fc.Args()[1]
cmd.serviceInstanceReq = requirementsFactory.NewServiceInstanceRequirement(serviceName)
minAPIVersionRequirement := requirementsFactory.NewMinAPIVersionRequirement(
"bind-route-service",
cf.MultipleAppPortsMinimumAPIVersion,
)
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
cmd.domainReq,
cmd.serviceInstanceReq,
minAPIVersionRequirement,
}
return reqs, nil
}
示例3: Requirements
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
}
示例4: Requirements
func (cmd *PurgeServiceInstance) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 1 {
cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + commandregistry.Commands.CommandUsage("purge-service-instance"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
requirementsFactory.NewMinAPIVersionRequirement("purge-service-instance", cf.RoutePathMinimumAPIVersion),
}
return reqs, nil
}
示例5: Requirements
func (cmd *MapRoute) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 2 {
cmd.ui.Failed(T("Incorrect Usage. Requires APP_NAME and DOMAIN as arguments\n\n") + commandregistry.Commands.CommandUsage("map-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.")
}
if fc.IsSet("random-port") && (fc.IsSet("port") || fc.IsSet("hostname") || fc.IsSet("path")) {
cmd.ui.Failed(T("Cannot specify random-port together with port, hostname and/or path."))
return nil, fmt.Errorf("Cannot specify random-port together with port, hostname and/or path.")
}
appName := fc.Args()[0]
domainName := fc.Args()[1]
requirement := requirementsFactory.NewApplicationRequirement(appName)
cmd.appReq = requirement
cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName)
var reqs []requirements.Requirement
if fc.String("path") != "" {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--path'", cf.RoutePathMinimumAPIVersion))
}
var flag string
switch {
case fc.IsSet("port"):
flag = "port"
case fc.IsSet("random-port"):
flag = "random-port"
}
if flag != "" {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement(fmt.Sprintf("Option '--%s'", flag), cf.TCPRoutingMinimumAPIVersion))
reqs = append(reqs, requirementsFactory.NewDiegoApplicationRequirement(appName))
}
reqs = append(reqs, []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
cmd.appReq,
cmd.domainReq,
}...)
return reqs, nil
}
示例6: Requirements
func (cmd *UpdateService) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 1 {
cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + commandregistry.Commands.CommandUsage("update-service"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
requirementsFactory.NewTargetedSpaceRequirement(),
}
if fc.String("p") != "" {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Updating a plan", cf.UpdateServicePlanMinimumAPIVersion))
}
return reqs, nil
}
示例7: Requirements
func (cmd *UpdateSpaceQuota) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 1 {
cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + commandregistry.Commands.CommandUsage("update-space-quota"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
requirementsFactory.NewTargetedOrgRequirement(),
}
if fc.IsSet("a") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '-a'", cf.SpaceAppInstanceLimitMinimumAPIVersion))
}
return reqs, nil
}
示例8: Requirements
func (cmd *CreateUserProvidedService) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 1 {
cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + commandregistry.Commands.CommandUsage("create-user-provided-service"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
requirementsFactory.NewTargetedSpaceRequirement(),
}
if fc.IsSet("r") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '-r'", cf.MultipleAppPortsMinimumAPIVersion))
}
return reqs, nil
}
示例9: Requirements
func (cmd *CreateSharedDomain) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 1 {
cmd.ui.Failed(T("Incorrect Usage. Requires DOMAIN as an argument\n\n") + commandregistry.Commands.CommandUsage("create-shared-domain"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
}
if fc.String("router-group") != "" {
reqs = append(reqs, []requirements.Requirement{
requirementsFactory.NewMinAPIVersionRequirement("Option '--router-group'", cf.RoutePathMinimumAPIVersion),
requirementsFactory.NewRoutingAPIRequirement(),
}...)
}
return reqs, nil
}
示例10: Requirements
func (cmd *CheckRoute) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 2 {
cmd.ui.Failed(T("Incorrect Usage. Requires host and domain as arguments\n\n") + commandregistry.Commands.CommandUsage("check-route"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 2)
}
var reqs []requirements.Requirement
if fc.String("path") != "" {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--path'", cf.RoutePathMinimumAPIVersion))
}
reqs = append(reqs, []requirements.Requirement{
requirementsFactory.NewTargetedOrgRequirement(),
requirementsFactory.NewLoginRequirement(),
}...)
return reqs, nil
}
示例11: Requirements
func (cmd *CreateServiceBroker) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 4 {
cmd.ui.Failed(T("Incorrect Usage. Requires SERVICE_BROKER, USERNAME, PASSWORD, URL as arguments\n\n") + commandregistry.Commands.CommandUsage("create-service-broker"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 4)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
}
if fc.IsSet("space-scoped") {
reqs = append(
reqs,
requirementsFactory.NewTargetedSpaceRequirement(),
requirementsFactory.NewMinAPIVersionRequirement("--space-scoped", cf.SpaceScopedMaximumAPIVersion),
)
}
return reqs, nil
}
示例12: Requirements
func (cmd *CreateQuota) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
if len(fc.Args()) != 1 {
cmd.ui.Failed(T("Incorrect Usage. Requires an argument\n\n") + commandregistry.Commands.CommandUsage("create-quota"))
return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
}
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
}
if fc.IsSet("a") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '-a'", cf.OrgAppInstanceLimitMinimumAPIVersion))
}
if fc.IsSet("reserved-route-ports") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--reserved-route-ports'", cf.ReservedRoutePortsMinimumAPIVersion))
}
return reqs, nil
}
示例13: Requirements
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") + commandregistry.Commands.CommandUsage("create-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.")
}
if fc.IsSet("random-port") && (fc.IsSet("port") || fc.IsSet("hostname") || fc.IsSet("path")) {
cmd.ui.Failed(T("Cannot specify random-port together with port, hostname and/or path."))
return nil, fmt.Errorf("Cannot specify random-port together with port, hostname and/or path.")
}
domainName := fc.Args()[1]
cmd.spaceReq = requirementsFactory.NewSpaceRequirement(fc.Args()[0])
cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName)
reqs := []requirements.Requirement{
requirementsFactory.NewLoginRequirement(),
requirementsFactory.NewTargetedOrgRequirement(),
cmd.spaceReq,
cmd.domainReq,
}
if fc.IsSet("path") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--path'", cf.RoutePathMinimumAPIVersion))
}
if fc.IsSet("port") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--port'", cf.TCPRoutingMinimumAPIVersion))
}
if fc.IsSet("random-port") {
reqs = append(reqs, requirementsFactory.NewMinAPIVersionRequirement("Option '--random-port'", cf.TCPRoutingMinimumAPIVersion))
}
return reqs, nil
}