Class: Grafana::Api::Org::Users
- Inherits:
-
Object
- Object
- Grafana::Api::Org::Users
- Defined in:
- lib/grafana-api/api/org/users.rb
Instance Method Summary collapse
- #create(add_org_user_command:) ⇒ Object
- #delete(user_id:) ⇒ Object
-
#initialize(connection) ⇒ Users
constructor
A new instance of Users.
- #list(query: nil, limit: nil) ⇒ Object
- #lookup(query: nil, limit: nil) ⇒ Object
- #partial_update(user_id:, update_org_user_command:) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Users
Returns a new instance of Users.
5 6 7 |
# File 'lib/grafana-api/api/org/users.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(add_org_user_command:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/grafana-api/api/org/users.rb', line 9 def create(add_org_user_command:) raise ArgumentError, 'add_org_user_command is required' if add_org_user_command.nil? @connection.call( :POST, '/org/users', type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: add_org_user_command ) end |
#delete(user_id:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grafana-api/api/org/users.rb', line 21 def delete(user_id:) raise ArgumentError, 'user_id is required' if user_id.nil? @connection.call( :DELETE, '/org/users/{user_id}' .gsub('{user_id}', ERB::Util.url_encode(user_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'] ) end |
#list(query: nil, limit: nil) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/grafana-api/api/org/users.rb', line 33 def list(query: nil, limit: nil) @connection.call( :GET, '/org/users', type: [Grafana::Api::Models::OrgUserDTO], auth: ['api_key', 'basic'], query: { 'query' => query, 'limit' => limit } ) end |
#lookup(query: nil, limit: nil) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/grafana-api/api/org/users.rb', line 43 def lookup(query: nil, limit: nil) @connection.call( :GET, '/org/users/lookup', type: [Grafana::Api::Models::UserLookupDTO], auth: ['api_key', 'basic'], query: { 'query' => query, 'limit' => limit } ) end |
#partial_update(user_id:, update_org_user_command:) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/grafana-api/api/org/users.rb', line 53 def partial_update(user_id:, update_org_user_command:) raise ArgumentError, 'user_id is required' if user_id.nil? raise ArgumentError, 'update_org_user_command is required' if update_org_user_command.nil? @connection.call( :PATCH, '/org/users/{user_id}' .gsub('{user_id}', ERB::Util.url_encode(user_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: update_org_user_command ) end |