Files
ubicloud/cli-commands/ps/post/create.rb
Jeremy Evans e90e6deaf7 Reimplement CLI processing using the Ruby SDK
This changes the custom code in UbiCli and the cli-commands files to use
the Ruby SDK for all changes.  This is slightly slower, but allows for
testing Ruby SDK using the existing tests for the CLI.

The only spec change is to an error message, and the error message is now
more helpful.

As the Ruby SDK uses symbol keys instead of string keys, this switches
UbiCli and the cli-commands files to also use symbol keys.

This adds an UbiCli#check_no_slash helper method to DRY up code that
checks for slashes in strings used as path fragments.
2025-03-28 16:25:47 -07:00

16 lines
449 B
Ruby

# frozen_string_literal: true
UbiCli.on("ps").run_on("create") do
desc "Create a private subnet"
options("ubi ps location/ps-name create [options]", key: :ps_create) do
on("-f", "--firewall-id=id", "add to given firewall")
end
run do |opts|
params = underscore_keys(opts[:ps_create])
id = sdk.private_subnet.create(location: @location, name: @name, **params).id
response("Private subnet created with id: #{id}")
end
end