Class: SchwarmCli::Commands::Secrets
- Inherits:
-
Base
- Object
- Thor
- Base
- SchwarmCli::Commands::Secrets
show all
- Defined in:
- lib/schwarm_cli/commands/secrets.rb
Constant Summary
Constants inherited
from Base
Base::DEFAULT_LIST_LIMIT
Instance Method Summary
collapse
Methods inherited from Base
exit_on_failure?, pagination_options
Instance Method Details
#create ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/schwarm_cli/commands/secrets.rb', line 34
def create
handle_errors do
attrs = {
github_repository_id: resolve_repo(options[:repo]),
path: options[:path], content: read_content(required: true)
}
data = client.secrets.create(**attrs)
output_record(data, fields: { "ID" => "id", "Path" => "path" })
end
end
|
#delete(id) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/schwarm_cli/commands/secrets.rb', line 58
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
|
# 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: resolve_repo(options[:repo]), **page_params)
end
output_list(data, columns: [%w[ID id], %w[REPO github_repository_name], %w[PATH path]])
end
end
|
#show(id) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/schwarm_cli/commands/secrets.rb', line 19
def show(id)
handle_errors do
data = client.secrets.find(id)
output_record(data, fields: {
"ID" => "id", "Repository" => "github_repository_name",
"Path" => "path", "Created" => "created_at", "Updated" => "updated_at"
})
end
end
|
#update(id) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/schwarm_cli/commands/secrets.rb', line 50
def update(id)
handle_errors do
data = client.secrets.update(id, **update_attrs)
output_record(data, fields: { "ID" => "id", "Path" => "path" })
end
end
|