Class: FlexOps::Resources::ApiKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/flexops/resources/api_keys.rb

Instance Method Summary collapse

Constructor Details

#initialize(http, ws_id_proc) ⇒ ApiKeys

Returns a new instance of ApiKeys.



12
13
14
15
# File 'lib/flexops/resources/api_keys.rb', line 12

def initialize(http, ws_id_proc)
  @http = http
  @ws_id = ws_id_proc
end

Instance Method Details

#create(request) ⇒ Object



21
22
23
# File 'lib/flexops/resources/api_keys.rb', line 21

def create(request)
  @http.post("#{ws_path}/api-keys", body: request)
end

#listObject



17
18
19
# File 'lib/flexops/resources/api_keys.rb', line 17

def list
  @http.get("#{ws_path}/api-keys")
end

#revoke(key_id) ⇒ Object



25
26
27
# File 'lib/flexops/resources/api_keys.rb', line 25

def revoke(key_id)
  @http.delete("#{ws_path}/api-keys/#{key_id}")
end

#rotate(key_id) ⇒ Object



29
30
31
# File 'lib/flexops/resources/api_keys.rb', line 29

def rotate(key_id)
  @http.post("#{ws_path}/api-keys/#{key_id}/rotate")
end