Class: Sem::CLI::Teams::Secrets

Inherits:
Dracula
  • Object
show all
Defined in:
lib/sem/cli/teams.rb

Instance Method Summary collapse

Instance Method Details

#add(team_name, secret_name) ⇒ Object



286
287
288
289
290
291
292
293
# File 'lib/sem/cli/teams.rb', line 286

def add(team_name, secret_name)
  team = Sem::API::Team.find!(team_name)
  secret = Sem::API::Secret.find!(secret_name)

  team.add_secret(secret)

  puts "Secrets #{secret_name} added to the team."
end

#list(team_name) ⇒ Object



268
269
270
271
272
273
274
275
276
277
# File 'lib/sem/cli/teams.rb', line 268

def list(team_name)
  team = Sem::API::Team.find!(team_name)
  configs = team.secrets

  if !configs.empty?
    Sem::Views::Secrets.list(configs)
  else
    Sem::Views::Teams.add_first_secrets(team)
  end
end

#remove(team_name, secret_name) ⇒ Object



302
303
304
305
306
307
308
309
# File 'lib/sem/cli/teams.rb', line 302

def remove(team_name, secret_name)
  team = Sem::API::Team.find!(team_name)
  secret = Sem::API::Secret.find!(secret_name)

  team.remove_secret(secret)

  puts "Secrets #{secret_name} removed from the team."
end