class CFAdmin::ServiceAuthToken

Public Instance Methods

create_service_auth_token() click to toggle source
# File lib/admin/service_auth_token.rb, line 40
def create_service_auth_token
  sat = client.service_auth_token
  sat.label = input[:label]
  sat.provider = input[:provider]
  sat.token = input[:token]

  with_progress("Creating service auth token") do
    sat.create!
  end
end
delete_service_auth_token() click to toggle source
# File lib/admin/service_auth_token.rb, line 85
def delete_service_auth_token
  sat = input[:service_auth_token]

  with_progress("Deleting token #{c(sat.label, :name)}") do
    sat.delete!
  end
end
precondition() click to toggle source
# File lib/admin/service_auth_token.rb, line 5
def precondition
  unless File.exists? target_file
    fail "Please select a target with 'truck target'."
  end

  unless client.logged_in?
    fail "Please log in with 'truck login'."
  end
end
service_auth_tokens() click to toggle source
# File lib/admin/service_auth_token.rb, line 18
def service_auth_tokens
  spaced(client.service_auth_tokens) do |t|
    line "#{c(t.label, :name)}:"

    indented do
      line "guid: #{t.guid}"
      line "provider: #{t.provider}"
    end
  end
end
update_service_auth_token() click to toggle source
# File lib/admin/service_auth_token.rb, line 65
def update_service_auth_token
  sat = input[:service_auth_token]
  sat.token = input[:token]

  with_progress("Updating token #{c(sat.label, :name)}") do
    sat.update!
  end
end