3.10. 创建方法
使用 3scale toolbox 在 Developer Portal 中创建、应用、列出和删除方法。
3.10.1. 创建方法 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
使用以下步骤创建方法:
- 您必须提供方法名称。
-
要覆盖
system-name,请使用可选参数。 - 如果存在具有相同名称的方法,您将看到错误消息。
通过
--disabled标志创建禁用的方法。-
默认情况下将
启用它。
-
默认情况下将
注意
服务位置参数是服务引用,可以是服务ID或 servicesystem_name。- toolbox 使用其中任一个。
以下命令创建一个方法:
3scale method create [opts] <remote> <service> <method-name>
在创建方法时使用以下选项:
Options
--description=<value> Set a method description
--disabled Disable this method in all
application plans
-o --output=<value> Output format on stdout:
one of json|yaml
-t --system-name=<value> Set the method system name
Options for method
-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
3.10.2. 创建或更新方法 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
如果方法不存在,请使用以下步骤创建新方法,或更新现有的方法:
- 如果存在具有相同名称的方法,命令将返回错误消息。
-
使用
--disabled 标志更新为禁用的方法。 -
使用
--enabled 标志将 更新为启用的方法。
注意
服务位置参数是服务引用,可以是服务ID或 servicesystem_name。- toolbox 使用其中任一个。
方法位置参数是方法引用,可以是方法id或方法system_name。- toolbox 使用其中任一个。
以下命令更新方法:
3scale method apply [opts] <remote> <service> <method>
在更新方法时使用以下选项:
Options
--description=<value> Set a method description
--disabled Disable this method in all
application plans
--enabled Enable this method in all
application plans
-n --name=<value> Set the method name
-o --output=<value> Output format on stdout:
one of json|yaml
Options for method
-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
3.10.3. 列出方法 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
以下命令列出方法:
3scale method list [opts] <remote> <service>
在列出方法时使用以下选项:
Options
-o --output=<value> Output format on stdout:
one of json|yaml
Options for method
-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
3.10.4. 删除方法 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
以下命令删除方法:
3scale method delete [opts] <remote> <service> <metric>
在删除方法时使用以下选项:
Options for method
-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