class Wavefront::ServiceAccount

Manage and query Wavefront service accounts

Public Instance Methods

activate(id) click to toggle source

POST /api/v2/account/serviceaccount/{id}/activate Activates the given service account

@param id [String] ID of the account @return [Wavefront::Response]

# File lib/wavefront-sdk/serviceaccount.rb, line 75
def activate(id)
  wf_serviceaccount_id?(id)
  api.post([id, 'activate'].uri_concat, nil, 'application/json')
end
api_base() click to toggle source
# File lib/wavefront-sdk/serviceaccount.rb, line 10
def api_base
  '/account/serviceaccount'
end
create(body) click to toggle source

POST /api/v2/account/serviceaccount Creates a service account Refer to the Swagger API docs for valid keys.

@param body [Hash] description of service account @return [Wavefront::Response]

# File lib/wavefront-sdk/serviceaccount.rb, line 31
def create(body)
  raise ArgumentError unless body.is_a?(Hash)

  api.post('', body, 'application/json')
end
deactivate(id) click to toggle source

POST /api/v2/account/serviceaccount/{id}/deactivate Deactivates the given service account

@param id [String] ID of the account @return [Wavefront::Response]

# File lib/wavefront-sdk/serviceaccount.rb, line 86
def deactivate(id)
  wf_serviceaccount_id?(id)
  api.post([id, 'deactivate'].uri_concat, nil, 'application/json')
end
describe(id) click to toggle source

GET /api/v2/account/serviceaccount/{id} Retrieves a service account by identifier

@param id [String] ID of the account @return [Wavefront::Response]

# File lib/wavefront-sdk/serviceaccount.rb, line 43
def describe(id)
  wf_serviceaccount_id?(id)
  api.get(id)
end
list() click to toggle source

GET /api/v2/account/serviceaccount Get all service accounts

@param offset [Integer] webhook at which the list begins @param limit [Integer] the number of webhooks to return

# File lib/wavefront-sdk/serviceaccount.rb, line 20
def list
  api.get('')
end
update(id, body, modify = true) click to toggle source

PUT /api/v2/account/serviceaccount/{id} Updates the service account

@param id [String] a Wavefront service account ID @param body [Hash] key-value hash of the parameters you wish

to change

@param modify [true, false] if true, use {#describe()} to get

a hash describing the existing object, and modify that with
the new body. If false, pass the new body straight through.

@return [Wavefront::Response]

# File lib/wavefront-sdk/serviceaccount.rb, line 59
def update(id, body, modify = true)
  wf_serviceaccount_id?(id)
  raise ArgumentError unless body.is_a?(Hash)

  return api.put(id, body, 'application/json') unless modify

  api.put(id, hash_for_update(describe(id).response, body),
          'application/json')
end
update_keys() click to toggle source
# File lib/wavefront-sdk/serviceaccount.rb, line 91
def update_keys
  %i[description tokens groups userGroups active identifier]
end