ubicloud/cli-commands/ps/post/disconnect.rb
Jeremy Evans 21128e2d8f Do not require location name when connecting/disconnecting subnets
Subnets must now be in the same location, so the location name would
be redundant.  Make the ps connect/disconnect similar to other cli
commands and no longer require the location name.

This removes the last remaining use of the convert_loc_name_to_id
helper method. All cli use allowing referencing objects by name
instead id now only supports objects in the same location.
2025-10-02 17:21:27 -07:00

17 lines
501 B
Ruby

# frozen_string_literal: true
UbiCli.on("ps").run_on("disconnect") do
desc "Disconnect a private subnet from another private subnet"
banner "ubi ps (location/ps-name | ps-id) disconnect (ps-name | ps-id)"
args 1
run do |ps_id, _, cmd|
arg = ps_id
ps_id = convert_name_to_id(sdk.private_subnet, ps_id)
check_no_slash(ps_id, "invalid private subnet id format", cmd)
id = sdk_object.disconnect(ps_id).id
response("Disconnected private subnet #{arg} from #{id}")
end
end