Files
ubicloud/cli-commands/pg/post/add-metric-destination.rb
Jeremy Evans cbf2d95cbb Revert the backout of the CLI support
This reverts commit b741fe9005.

This was backed out as problems started occuring shortly after
a large CLI pull request was merged.  However, log analysis
shows that the CLI was unrelated to the problems.
2025-02-11 16:09:46 -08:00

19 lines
703 B
Ruby

# frozen_string_literal: true
UbiRodish.on("pg").run_is("add-metric-destination", args: 3, invalid_args_message: "username, password, and url are required") do |username, password, url|
params = {
"username" => username,
"password" => password,
"url" => url
}
post(project_path("location/#{@location}/postgres/#{@name}/metric-destination"), params) do |data|
body = []
body << "Metric destination added to PostgreSQL database.\n"
body << "Current metric destinations:\n"
data["metric_destinations"].each_with_index do |md, i|
body << " " << (i + 1).to_s << ": " << md["id"] << " " << md["username"].to_s << " " << md["url"] << "\n"
end
body
end
end