Class: Grafana::Api::User

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

Defined Under Namespace

Classes: Helpflags, Orgs, Quotas, Teams, Using

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ User

Returns a new instance of User.



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

def initialize(connection)
  @connection = connection
end

Instance Method Details

#auth_tokensObject



9
10
11
12
13
14
15
16
# File 'lib/grafana-api/api/user.rb', line 9

def auth_tokens
  @connection.call(
    :GET,
    '/user/auth-tokens',
    type: [Grafana::Api::Models::UserToken],
    auth: ['api_key', 'basic']
  )
end

#bulk_update(update_user_command:) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/grafana-api/api/user.rb', line 18

def bulk_update(update_user_command:)
  raise ArgumentError, 'update_user_command is required' if update_user_command.nil?

  @connection.call(
    :PUT,
    '/user',
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['api_key', 'basic'],
    body: update_user_command
  )
end

#email_updateObject



30
31
32
33
34
35
36
37
# File 'lib/grafana-api/api/user.rb', line 30

def email_update
  @connection.call(
    :GET,
    '/user/email/update',
    type: nil,
    auth: ['api_key', 'basic']
  )
end

#listObject



39
40
41
42
43
44
45
46
# File 'lib/grafana-api/api/user.rb', line 39

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

#password(change_user_password_command:) ⇒ Object

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/grafana-api/api/user.rb', line 48

def password(change_user_password_command:)
  raise ArgumentError, 'change_user_password_command is required' if change_user_password_command.nil?

  @connection.call(
    :PUT,
    '/user/password',
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['basic'],
    body: change_user_password_command
  )
end

#preferencesObject



60
61
62
63
64
65
66
67
# File 'lib/grafana-api/api/user.rb', line 60

def preferences
  @connection.call(
    :GET,
    '/user/preferences',
    type: Grafana::Api::Models::PreferencesSpec,
    auth: ['api_key', 'basic']
  )
end

#preferences_patch(patch_prefs_cmd:) ⇒ Object

Raises:

  • (ArgumentError)


69
70
71
72
73
74
75
76
77
78
79
# File 'lib/grafana-api/api/user.rb', line 69

def preferences_patch(patch_prefs_cmd:)
  raise ArgumentError, 'patch_prefs_cmd is required' if patch_prefs_cmd.nil?

  @connection.call(
    :PATCH,
    '/user/preferences',
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['api_key', 'basic'],
    body: patch_prefs_cmd
  )
end

#preferences_put(update_prefs_cmd:) ⇒ Object

Raises:

  • (ArgumentError)


81
82
83
84
85
86
87
88
89
90
91
# File 'lib/grafana-api/api/user.rb', line 81

def preferences_put(update_prefs_cmd:)
  raise ArgumentError, 'update_prefs_cmd is required' if update_prefs_cmd.nil?

  @connection.call(
    :PUT,
    '/user/preferences',
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['api_key', 'basic'],
    body: update_prefs_cmd
  )
end

#revoke_auth_token(revoke_auth_token_cmd:) ⇒ Object

Raises:

  • (ArgumentError)


93
94
95
96
97
98
99
100
101
102
103
# File 'lib/grafana-api/api/user.rb', line 93

def revoke_auth_token(revoke_auth_token_cmd:)
  raise ArgumentError, 'revoke_auth_token_cmd is required' if revoke_auth_token_cmd.nil?

  @connection.call(
    :POST,
    '/user/revoke-auth-token',
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['api_key', 'basic'],
    body: revoke_auth_token_cmd
  )
end

#stars_dashboard_uid(dashboard_uid:) ⇒ Object

Raises:

  • (ArgumentError)


105
106
107
108
109
110
111
112
113
114
115
# File 'lib/grafana-api/api/user.rb', line 105

def stars_dashboard_uid(dashboard_uid:)
  raise ArgumentError, 'dashboard_uid is required' if dashboard_uid.nil?

  @connection.call(
    :POST,
    '/user/stars/dashboard/uid/{dashboard_uid}'
      .gsub('{dashboard_uid}', ERB::Util.url_encode(dashboard_uid.to_s)),
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['api_key', 'basic']
  )
end

#stars_dashboard_uid_delete(dashboard_uid:) ⇒ Object

Raises:

  • (ArgumentError)


117
118
119
120
121
122
123
124
125
126
127
# File 'lib/grafana-api/api/user.rb', line 117

def stars_dashboard_uid_delete(dashboard_uid:)
  raise ArgumentError, 'dashboard_uid is required' if dashboard_uid.nil?

  @connection.call(
    :DELETE,
    '/user/stars/dashboard/uid/{dashboard_uid}'
      .gsub('{dashboard_uid}', ERB::Util.url_encode(dashboard_uid.to_s)),
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['api_key', 'basic']
  )
end