5.10. 创建应用程序计划
使用 3scale toolbox 在 Developer Portal 中创建、更新、列出、删除、显示或导出/导入应用程序计划。
5.10.1. 创建新应用程序计划 复制链接链接已复制到粘贴板!
使用以下步骤创建新应用程序计划:
- 您必须提供应用计划名称。
-
要覆盖
system-name,请使用可选参数。 - 如果存在具有相同名称的应用计划,您将看到错误消息。
-
使用
--default标志,将应用计划设置为--default。 使用
--publish标志创建一个发布的应用计划。-
默认情况下,它将被
隐藏。
-
默认情况下,它将被
使用
--disabled标志创建禁用的应用程序计划。-
默认情况下将
启用它。
-
默认情况下将
服务位置参数是服务引用,可以是服务ID或 servicesystem_name。- toolbox 使用其中任一个。
以下命令创建新应用程序计划:
3scale application-plan create [opts] <remote> <service> <plan-name>
在创建应用程序计划时使用以下选项:
Options
--approval-required=<value> The application requires approval:
true or false
--cost-per-month=<value> Cost per month
--default Make the default application plan
--disabled Disable all methods and metrics in
the application plan
-o --output=<value> Output format on stdout:
one of json|yaml
-p --published Publish the application plan
--setup-fee=<value> Set-up fee
-t --system-name=<value> Set application plan system name
--trial-period-days=<value> The trial period in days
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered
insecure
-v --version Print the version of this command
--verbose Verbose mode
5.10.2. 创建或更新应用程序计划 复制链接链接已复制到粘贴板!
如果使用以下步骤创建新应用程序计划(如果不存在),或更新现有应用程序计划:
-
使用
--default标志更新默认应用计划。 -
使用
--publish标志,更新发布的应用计划。 -
使用
--hide标志更新隐藏的应用计划。 -
使用
--disabled标志更新禁用的应用程序计划。 -
使用
--enabled标志,更新启用的应用计划。
服务位置参数是服务引用,可以是服务ID或 servicesystem_name。- toolbox 使用其中任一个。
plan位置参数是计划引用,可以是计划id或 plansystem_name。- toolbox 使用其中任一个。
以下命令更新应用程序计划:
3scale application-plan create [opts] <remote> <service> <plan>
在更新应用程序计划时使用以下选项:
Options
--approval-required=<value> The application requires approval:
true or false
--cost-per-month=<value> Cost per month
--default Make the default application plan
--disabled Disable all methods and metrics in
the application plan
--enabled Enable the application plan
--hide Hide the application plan
-n --name=<value> Set the plan name
-o --output=<value> Output format on stdout:
one of json|yaml
-p --publish Publish the application plan
--setup-fee=<value> Set-up fee
--trial-period-days=<value> The trial period in days
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered
insecure
-v --version Print the version of this command
--verbose Verbose mode
5.10.3. 列出应用计划 复制链接链接已复制到粘贴板!
以下命令列出应用程序计划:
3scale application-plan list [opts] <remote> <service>
在列出应用程序计划时使用以下选项:
Options
-o --output=<value> Output format on stdout:
one of json|yaml
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered insecure
-v --version Print the version of this command
--verbose Verbose mode
5.10.4. 显示应用程序计划 复制链接链接已复制到粘贴板!
以下命令显示应用程序计划:
3scale application-plan show [opts] <remote> <service> <plan>
在显示应用程序计划时使用以下选项:
Options
-o --output=<value> Output format on stdout:
one of json|yaml
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered insecure
-v --version Print the version of this command
--verbose Verbose mode
5.10.5. 删除应用程序计划 复制链接链接已复制到粘贴板!
以下命令删除应用程序计划:
3scale application-plan delete [opts] <remote> <service> <plan>
在删除应用程序计划时使用以下选项:
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered insecure
-v --version Print the version of this command
--verbose Verbose mode
5.10.6. 导出/导入应用程序计划 复制链接链接已复制到粘贴板!
您可以将单个应用程序计划导出或导入到 yaml 内容。
注意以下几点:
- 包括了应用程序计划中定义的限制。
- 包括了应用程序计划中定义的定价规则。
- 包括根据限制和价格规则引用的指标/方法。
- 应用程序计划中定义的功能包括:
-
服务可以被
id或system_name引用。 -
应用程序计划可以被
id或system_name来引用。
5.10.6.1. 将应用计划导出到文件 复制链接链接已复制到粘贴板!
以下命令导出应用程序计划:
3scale application-plan export [opts] <remote> <service_system_name> <plan_system_name>
示例
$ podman run -u root -v $PWD:/tmp registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.13 3scale application-plan export --file=/tmp/plan.yaml remote_name service_name plan_name
本例使用 Podman 卷将输出结果中的导出文件挂载到当前的 $PWD 文件夹。
特定于 export 命令:
- 对远程服务和应用计划进行只读操作.
命令输出可以是
stdout或文件。-
如果没有由
-f选项指定,则默认情况下,yaml内容将写入stdout。
-
如果没有由
在导出应用程序计划时使用以下选项:
Options
-f --file=<value> Write to file instead of stdout
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered insecure
-v --version Print the version of this command
--verbose Verbose mode
5.10.6.2. 从文件导入应用计划 复制链接链接已复制到粘贴板!
以下命令导入应用程序计划:
3scale application-plan import [opts] <remote> <service_system_name>
示例
$ podman run -v $PWD/plan.yaml:/tmp/plan.yaml registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.13 3scale application-plan import --file=/tmp/plan.yaml remote_name service_name
本例使用 Podman 卷从当前的 $PWD 文件夹挂载容器中导入的文件。
5.10.6.3. 从 URL 导入应用计划 复制链接链接已复制到粘贴板!
3scale application-plan import -f http[s]://domain/resource/path.yaml remote_name service_name
特定于导入命令:
命令输入内容可以
stdin、文件或 URL 格式。-
如果没有由
-f选项指定,默认情况下,yaml内容将从stdin中读取。
-
如果没有由
- 如果无法在远程服务中找到应用计划,它将被创建。
可选的 param
-p,--plan,用于覆盖远程目标应用程序计划id或system_name。-
如果没有通过
-p选项指定,默认情况下,应用程序计划将由来自yaml内容的计划属性system_name from引用。
-
如果没有通过
- 将创建在远程服务中没有的 yaml 内容中的任何指标或方法。
导入应用程序计划时使用以下选项:
Options
-f --file=<value> Read from file or URL instead of
stdin
-p --plan=<value> Override application plan reference
Options for application-plan
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered
insecure
-v --version Print the version of this command
--verbose Verbose mode