Class: SchwarmCli::Commands::Secrets
- Defined in:
- lib/schwarm_cli/commands/secrets.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 33 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
56 57 58 59 60 61 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 56 def delete(id) handle_errors do client.secrets.destroy(id) puts "Secret #{id} deleted." end end |
#list ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 8 def list handle_errors do data = client.secrets.list(repository_id: [:repo]) output_list(data, columns: [%w[ID id], %w[NAME name], %w[REPO github_repository_id], %w[PATH path]]) end end |
#show(id) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 17 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
48 49 50 51 52 53 |
# File 'lib/schwarm_cli/commands/secrets.rb', line 48 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 |