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.
16 lines
436 B
Ruby
16 lines
436 B
Ruby
# frozen_string_literal: true
|
|
|
|
UbiCli.on("fw").run_on("create") do
|
|
desc "Create a firewall"
|
|
|
|
options("ubi fw location/fw-name create [options]", key: :fw_create) do
|
|
on("-d", "--description=desc", "description for firewall")
|
|
end
|
|
|
|
run do |opts|
|
|
params = underscore_keys(opts[:fw_create])
|
|
id = sdk.firewall.create(location: @location, name: @name, **params).id
|
|
response("Firewall created with id: #{id}")
|
|
end
|
|
end
|