For option arguments that must be members of an array, do the check in the option parsing by providing an array of allowed option arguments (e.g. vm create -s bad). Emit better errors for options arguments that should be integers (e.g. fw add-rule -s/-e), and for regular arguments that should be integers (e.g. lb create src-port/dst-port). Include help output in additional cases: * invalid id formats with slashes * invalid/duplicate/missing fields used when multiple fields separated by a comma is allowed * invalid object references when using post subcommands * invalid location for list -l option
18 lines
599 B
Ruby
18 lines
599 B
Ruby
# frozen_string_literal: true
|
|
|
|
UbiCli.on("lb").run_on("update") do
|
|
desc "Update a load balancer"
|
|
|
|
banner "ubi lb (location/lb-name | lb-id) update algorithm src-port dst-port health-check-endpoint [vm-id [...]]"
|
|
|
|
args(4...)
|
|
|
|
run do |argv, _, cmd|
|
|
algorithm, src_port, dst_port, health_check_endpoint, *vms = argv
|
|
src_port = need_integer_arg(src_port, "src-port", cmd)
|
|
dst_port = need_integer_arg(dst_port, "dst-port", cmd)
|
|
id = sdk_object.update(algorithm:, src_port:, dst_port:, health_check_endpoint:, vms:).id
|
|
response("Updated load balancer with id #{id}")
|
|
end
|
|
end
|