Class: Grafana::Api::Teams
- Inherits:
-
Object
- Object
- Grafana::Api::Teams
- Defined in:
- lib/grafana-api/api/teams.rb
Defined Under Namespace
Instance Method Summary collapse
- #create(create_team_command:) ⇒ Object
- #delete(team_id:) ⇒ Object
- #get(team_id:, accesscontrol: nil) ⇒ Object
-
#initialize(connection) ⇒ Teams
constructor
A new instance of Teams.
- #preferences(team_id:) ⇒ Object
- #preferences_put(team_id:, update_prefs_cmd:) ⇒ Object
- #search(page: nil, perpage: nil, name: nil, query: nil, accesscontrol: nil, sort: nil) ⇒ Object
- #update(team_id:, update_team_command:) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Teams
Returns a new instance of Teams.
5 6 7 |
# File 'lib/grafana-api/api/teams.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(create_team_command:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/grafana-api/api/teams.rb', line 9 def create(create_team_command:) raise ArgumentError, 'create_team_command is required' if create_team_command.nil? @connection.call( :POST, '/teams', type: Grafana::Api::Models::CreateTeam200Response, auth: ['api_key', 'basic'], body: create_team_command ) end |
#delete(team_id:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grafana-api/api/teams.rb', line 21 def delete(team_id:) raise ArgumentError, 'team_id is required' if team_id.nil? @connection.call( :DELETE, '/teams/{team_id}' .gsub('{team_id}', ERB::Util.url_encode(team_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'] ) end |
#get(team_id:, accesscontrol: nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/grafana-api/api/teams.rb', line 33 def get(team_id:, accesscontrol: nil) raise ArgumentError, 'team_id is required' if team_id.nil? @connection.call( :GET, '/teams/{team_id}' .gsub('{team_id}', ERB::Util.url_encode(team_id.to_s)), type: Grafana::Api::Models::TeamDTO, auth: ['api_key', 'basic'], query: { 'accesscontrol' => accesscontrol } ) end |
#preferences(team_id:) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/grafana-api/api/teams.rb', line 46 def preferences(team_id:) raise ArgumentError, 'team_id is required' if team_id.nil? @connection.call( :GET, '/teams/{team_id}/preferences' .gsub('{team_id}', ERB::Util.url_encode(team_id.to_s)), type: Grafana::Api::Models::PreferencesSpec, auth: ['api_key', 'basic'] ) end |
#preferences_put(team_id:, update_prefs_cmd:) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/grafana-api/api/teams.rb', line 58 def preferences_put(team_id:, update_prefs_cmd:) raise ArgumentError, 'team_id is required' if team_id.nil? raise ArgumentError, 'update_prefs_cmd is required' if update_prefs_cmd.nil? @connection.call( :PUT, '/teams/{team_id}/preferences' .gsub('{team_id}', ERB::Util.url_encode(team_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: update_prefs_cmd ) end |
#search(page: nil, perpage: nil, name: nil, query: nil, accesscontrol: nil, sort: nil) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/grafana-api/api/teams.rb', line 72 def search(page: nil, perpage: nil, name: nil, query: nil, accesscontrol: nil, sort: nil) @connection.call( :GET, '/teams/search', type: Grafana::Api::Models::SearchTeamQueryResult, auth: ['api_key', 'basic'], query: { 'page' => page, 'perpage' => perpage, 'name' => name, 'query' => query, 'accesscontrol' => accesscontrol, 'sort' => sort } ) end |
#update(team_id:, update_team_command:) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/grafana-api/api/teams.rb', line 82 def update(team_id:, update_team_command:) raise ArgumentError, 'team_id is required' if team_id.nil? raise ArgumentError, 'update_team_command is required' if update_team_command.nil? @connection.call( :PUT, '/teams/{team_id}' .gsub('{team_id}', ERB::Util.url_encode(team_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: update_team_command ) end |