Class: SchwarmCli::Commands::Secrets
- Defined in:
- lib/schwarm_cli/commands/secrets.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#create ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 36 def create handle_errors do content = read_content attrs = { name: [:name], github_repository_id: [:repo], path: [:path], content: } data = client.secrets.create(**attrs) output_record(data, fields: { "ID" => "id", "Name" => "name", "Path" => "path" }) end end |
#delete(id) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 59 def delete(id) handle_errors do client.secrets.destroy(id) puts "Secret #{id} deleted." end end |
#list ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 9 def list handle_errors do data = fetch_paged do |page_params| client.secrets.list(repository_id: [:repo], **page_params) end output_list(data, columns: [%w[ID id], %w[NAME name], %w[REPO github_repository_name], %w[PATH path]]) end end |
#show(id) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 20 def show(id) handle_errors do data = client.secrets.find(id) output_record(data, fields: { "ID" => "id", "Name" => "name", "Repository" => "github_repository_id", "Path" => "path", "Created" => "created_at", "Updated" => "updated_at" }) end end |
#update(id) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 51 def update(id) handle_errors do data = client.secrets.update(id, **update_attrs) output_record(data, fields: { "ID" => "id", "Name" => "name", "Path" => "path" }) end end |