Class: Grafana::Api::Orgs::Users
- Inherits:
-
Object
- Object
- Grafana::Api::Orgs::Users
- Defined in:
- lib/grafana-api/api/orgs/users.rb
Instance Method Summary collapse
- #create(org_id:, add_org_user_command:) ⇒ Object
- #delete(org_id:, user_id:) ⇒ Object
-
#initialize(connection) ⇒ Users
constructor
A new instance of Users.
- #list(org_id:) ⇒ Object
- #partial_update(org_id:, user_id:, update_org_user_command:) ⇒ Object
- #search(org_id:) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Users
Returns a new instance of Users.
5 6 7 |
# File 'lib/grafana-api/api/orgs/users.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(org_id:, add_org_user_command:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/grafana-api/api/orgs/users.rb', line 9 def create(org_id:, add_org_user_command:) raise ArgumentError, 'org_id is required' if org_id.nil? raise ArgumentError, 'add_org_user_command is required' if add_org_user_command.nil? @connection.call( :POST, '/orgs/{org_id}/users' .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: add_org_user_command ) end |
#delete(org_id:, user_id:) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/grafana-api/api/orgs/users.rb', line 23 def delete(org_id:, user_id:) raise ArgumentError, 'org_id is required' if org_id.nil? raise ArgumentError, 'user_id is required' if user_id.nil? @connection.call( :DELETE, '/orgs/{org_id}/users/{user_id}' .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)) .gsub('{user_id}', ERB::Util.url_encode(user_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'] ) end |
#list(org_id:) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/grafana-api/api/orgs/users.rb', line 37 def list(org_id:) raise ArgumentError, 'org_id is required' if org_id.nil? @connection.call( :GET, '/orgs/{org_id}/users' .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)), type: [Grafana::Api::Models::OrgUserDTO], auth: ['basic'] ) end |
#partial_update(org_id:, user_id:, update_org_user_command:) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/grafana-api/api/orgs/users.rb', line 49 def partial_update(org_id:, user_id:, update_org_user_command:) raise ArgumentError, 'org_id is required' if org_id.nil? 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, '/orgs/{org_id}/users/{user_id}' .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)) .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 |
#search(org_id:) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/grafana-api/api/orgs/users.rb', line 65 def search(org_id:) raise ArgumentError, 'org_id is required' if org_id.nil? @connection.call( :GET, '/orgs/{org_id}/users/search' .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)), type: Grafana::Api::Models::SearchOrgUsersQueryResult, auth: ['basic'] ) end |