Class: Grafana::Api::Licensing::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/grafana-api/api/licensing/token.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Token

Returns a new instance of Token.



5
6
7
# File 'lib/grafana-api/api/licensing/token.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Method Details

#bulk_destroy(delete_token_command:) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grafana-api/api/licensing/token.rb', line 9

def bulk_destroy(delete_token_command:)
  raise ArgumentError, 'delete_token_command is required' if delete_token_command.nil?

  @connection.call(
    :DELETE,
    '/licensing/token',
    type: Grafana::Api::Models::ErrorResponseBody,
    auth: ['api_key', 'basic'],
    body: delete_token_command
  )
end

#create(delete_token_command:) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/grafana-api/api/licensing/token.rb', line 21

def create(delete_token_command:)
  raise ArgumentError, 'delete_token_command is required' if delete_token_command.nil?

  @connection.call(
    :POST,
    '/licensing/token',
    type: Grafana::Api::Models::Token,
    auth: ['api_key', 'basic'],
    body: delete_token_command
  )
end

#listObject



33
34
35
36
37
38
39
40
# File 'lib/grafana-api/api/licensing/token.rb', line 33

def list
  @connection.call(
    :GET,
    '/licensing/token',
    type: Grafana::Api::Models::Token,
    auth: ['api_key', 'basic']
  )
end

#renew(body:) ⇒ Object

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
# File 'lib/grafana-api/api/licensing/token.rb', line 42

def renew(body:)
  raise ArgumentError, 'body is required' if body.nil?

  @connection.call(
    :POST,
    '/licensing/token/renew',
    type: nil,
    auth: ['api_key', 'basic'],
    body: body
  )
end