Class: OpenapiClient::RolesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/api/roles_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RolesApi

Returns a new instance of RolesApi.



19
20
21
# File 'lib/openapi_client/api/roles_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/openapi_client/api/roles_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_parent_role(proj_id, env_id, role_id, parent_role_id, opts = {}) ⇒ RoleRead

Add Parent Role This endpoint is part of the role hierarchy feature. Makes role with id ‘role_id` extend the role with id `parent_role_id`. In other words, `role_id` will automatically be assigned any permissions that are granted to `parent_role_id`. We can say the `role_id` extends `parent_role_id` or inherits from `parent_role_id`. If `role_id` is already an ancestor of `parent_role_id`, the request will fail with HTTP 400 to prevent a cycle in the role hierarchy.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the "slug").

  • parent_role_id (String)

    Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the "slug").

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



30
31
32
33
# File 'lib/openapi_client/api/roles_api.rb', line 30

def add_parent_role(proj_id, env_id, role_id, parent_role_id, opts = {})
  data, _status_code, _headers = add_parent_role_with_http_info(proj_id, env_id, role_id, parent_role_id, opts)
  data
end

#add_parent_role_with_http_info(proj_id, env_id, role_id, parent_role_id, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Add Parent Role This endpoint is part of the role hierarchy feature. Makes role with id &#x60;role_id&#x60; extend the role with id &#x60;parent_role_id&#x60;. In other words, &#x60;role_id&#x60; will automatically be assigned any permissions that are granted to &#x60;parent_role_id&#x60;. We can say the &#x60;role_id&#x60; extends &#x60;parent_role_id&#x60; or inherits from &#x60;parent_role_id&#x60;. If &#x60;role_id&#x60; is already an ancestor of &#x60;parent_role_id&#x60;, the request will fail with HTTP 400 to prevent a cycle in the role hierarchy.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • parent_role_id (String)

    Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/openapi_client/api/roles_api.rb', line 43

def add_parent_role_with_http_info(proj_id, env_id, role_id, parent_role_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.add_parent_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.add_parent_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.add_parent_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.add_parent_role"
  end
  # verify the required parameter 'parent_role_id' is set
  if @api_client.config.client_side_validation && parent_role_id.nil?
    fail ArgumentError, "Missing the required parameter 'parent_role_id' when calling RolesApi.add_parent_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}/parents/{parent_role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)).sub('{' + 'parent_role_id' + '}', CGI.escape(parent_role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.add_parent_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#add_parent_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#assign_permissions_to_role(proj_id, env_id, role_id, add_role_permissions, opts = {}) ⇒ RoleRead

Assign Permissions To Role Assign permissions to role. If some of the permissions specified are already unassigned, will skip them.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • add_role_permissions (AddRolePermissions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



111
112
113
114
# File 'lib/openapi_client/api/roles_api.rb', line 111

def assign_permissions_to_role(proj_id, env_id, role_id, add_role_permissions, opts = {})
  data, _status_code, _headers = assign_permissions_to_role_with_http_info(proj_id, env_id, role_id, add_role_permissions, opts)
  data
end

#assign_permissions_to_role_with_http_info(proj_id, env_id, role_id, add_role_permissions, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Assign Permissions To Role Assign permissions to role. If some of the permissions specified are already unassigned, will skip them.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • add_role_permissions (AddRolePermissions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/openapi_client/api/roles_api.rb', line 124

def assign_permissions_to_role_with_http_info(proj_id, env_id, role_id, add_role_permissions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.assign_permissions_to_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.assign_permissions_to_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.assign_permissions_to_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.assign_permissions_to_role"
  end
  # verify the required parameter 'add_role_permissions' is set
  if @api_client.config.client_side_validation && add_role_permissions.nil?
    fail ArgumentError, "Missing the required parameter 'add_role_permissions' when calling RolesApi.assign_permissions_to_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}/permissions'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(add_role_permissions)

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.assign_permissions_to_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#assign_permissions_to_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_role(proj_id, env_id, role_create, opts = {}) ⇒ RoleRead

Create Role Creates a new tenant role.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_create (RoleCreate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



196
197
198
199
# File 'lib/openapi_client/api/roles_api.rb', line 196

def create_role(proj_id, env_id, role_create, opts = {})
  data, _status_code, _headers = create_role_with_http_info(proj_id, env_id, role_create, opts)
  data
end

#create_role_with_http_info(proj_id, env_id, role_create, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Create Role Creates a new tenant role.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_create (RoleCreate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/openapi_client/api/roles_api.rb', line 208

def create_role_with_http_info(proj_id, env_id, role_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.create_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.create_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.create_role"
  end
  # verify the required parameter 'role_create' is set
  if @api_client.config.client_side_validation && role_create.nil?
    fail ArgumentError, "Missing the required parameter 'role_create' when calling RolesApi.create_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(role_create)

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.create_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#create_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_role(proj_id, env_id, role_id, opts = {}) ⇒ nil

Delete Role Deletes a tenant role and all its related data. This includes any permissions granted to said role.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


276
277
278
279
# File 'lib/openapi_client/api/roles_api.rb', line 276

def delete_role(proj_id, env_id, role_id, opts = {})
  delete_role_with_http_info(proj_id, env_id, role_id, opts)
  nil
end

#delete_role_with_http_info(proj_id, env_id, role_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Role Deletes a tenant role and all its related data. This includes any permissions granted to said role.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/openapi_client/api/roles_api.rb', line 288

def delete_role_with_http_info(proj_id, env_id, role_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.delete_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.delete_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.delete_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.delete_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.delete_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#delete_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_role(proj_id, env_id, role_id, opts = {}) ⇒ RoleRead

Get Role Gets a single tenant role, if such role exists.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



351
352
353
354
# File 'lib/openapi_client/api/roles_api.rb', line 351

def get_role(proj_id, env_id, role_id, opts = {})
  data, _status_code, _headers = get_role_with_http_info(proj_id, env_id, role_id, opts)
  data
end

#get_role_with_http_info(proj_id, env_id, role_id, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Get Role Gets a single tenant role, if such role exists.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/openapi_client/api/roles_api.rb', line 363

def get_role_with_http_info(proj_id, env_id, role_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.get_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.get_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.get_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.get_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.get_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#get_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_roles(proj_id, env_id, opts = {}) ⇒ Array<RoleRead>

List Roles Lists all tenant roles.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number of the results to fetch, starting at 1. (default to 1)

  • :per_page (Integer)

    The number of results per page (max 100). (default to 30)

Returns:



427
428
429
430
# File 'lib/openapi_client/api/roles_api.rb', line 427

def list_roles(proj_id, env_id, opts = {})
  data, _status_code, _headers = list_roles_with_http_info(proj_id, env_id, opts)
  data
end

#list_roles_with_http_info(proj_id, env_id, opts = {}) ⇒ Array<(Array<RoleRead>, Integer, Hash)>

List Roles Lists all tenant roles.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number of the results to fetch, starting at 1. (default to 1)

  • :per_page (Integer)

    The number of results per page (max 100). (default to 30)

Returns:

  • (Array<(Array<RoleRead>, Integer, Hash)>)

    Array<RoleRead> data, response status code and response headers



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/openapi_client/api/roles_api.rb', line 440

def list_roles_with_http_info(proj_id, env_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.list_roles ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.list_roles"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.list_roles"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling RolesApi.list_roles, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling RolesApi.list_roles, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling RolesApi.list_roles, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<RoleRead>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.list_roles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#list_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_parent_role(proj_id, env_id, role_id, parent_role_id, opts = {}) ⇒ RoleRead

Remove Parent Role This endpoint is part of the role hierarchy feature. Removes ‘parent_role_id` from the list of parent roles of role with id `role_id`. In other words, `role_id` will no longer be automatically assigned permissions that are granted to `parent_role_id`. We can say the `role_id` **not longer extends** `parent_role_id` or **no longer inherits** from `parent_role_id`.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • parent_role_id (String)

    Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



514
515
516
517
# File 'lib/openapi_client/api/roles_api.rb', line 514

def remove_parent_role(proj_id, env_id, role_id, parent_role_id, opts = {})
  data, _status_code, _headers = remove_parent_role_with_http_info(proj_id, env_id, role_id, parent_role_id, opts)
  data
end

#remove_parent_role_with_http_info(proj_id, env_id, role_id, parent_role_id, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Remove Parent Role This endpoint is part of the role hierarchy feature. Removes &#x60;parent_role_id&#x60; from the list of parent roles of role with id &#x60;role_id&#x60;. In other words, &#x60;role_id&#x60; will no longer be automatically assigned permissions that are granted to &#x60;parent_role_id&#x60;. We can say the &#x60;role_id&#x60; **not longer extends** &#x60;parent_role_id&#x60; or **no longer inherits** from &#x60;parent_role_id&#x60;.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • parent_role_id (String)

    Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/openapi_client/api/roles_api.rb', line 527

def remove_parent_role_with_http_info(proj_id, env_id, role_id, parent_role_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.remove_parent_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.remove_parent_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.remove_parent_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.remove_parent_role"
  end
  # verify the required parameter 'parent_role_id' is set
  if @api_client.config.client_side_validation && parent_role_id.nil?
    fail ArgumentError, "Missing the required parameter 'parent_role_id' when calling RolesApi.remove_parent_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}/parents/{parent_role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)).sub('{' + 'parent_role_id' + '}', CGI.escape(parent_role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.remove_parent_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#remove_parent_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_permissions_from_role(proj_id, env_id, role_id, remove_role_permissions, opts = {}) ⇒ RoleRead

Remove Permissions From Role Remove permissions from role. If some of the permissions specified are already unassigned, will skip them.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • remove_role_permissions (RemoveRolePermissions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



595
596
597
598
# File 'lib/openapi_client/api/roles_api.rb', line 595

def remove_permissions_from_role(proj_id, env_id, role_id, remove_role_permissions, opts = {})
  data, _status_code, _headers = remove_permissions_from_role_with_http_info(proj_id, env_id, role_id, remove_role_permissions, opts)
  data
end

#remove_permissions_from_role_with_http_info(proj_id, env_id, role_id, remove_role_permissions, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Remove Permissions From Role Remove permissions from role. If some of the permissions specified are already unassigned, will skip them.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • remove_role_permissions (RemoveRolePermissions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/openapi_client/api/roles_api.rb', line 608

def remove_permissions_from_role_with_http_info(proj_id, env_id, role_id, remove_role_permissions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.remove_permissions_from_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.remove_permissions_from_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.remove_permissions_from_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.remove_permissions_from_role"
  end
  # verify the required parameter 'remove_role_permissions' is set
  if @api_client.config.client_side_validation && remove_role_permissions.nil?
    fail ArgumentError, "Missing the required parameter 'remove_role_permissions' when calling RolesApi.remove_permissions_from_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}/permissions'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(remove_role_permissions)

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.remove_permissions_from_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#remove_permissions_from_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_role(proj_id, env_id, role_id, role_update, opts = {}) ⇒ RoleRead

Update Role Partially updates a tenant role. Fields that will be provided will be completely overwritten.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • role_update (RoleUpdate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



681
682
683
684
# File 'lib/openapi_client/api/roles_api.rb', line 681

def update_role(proj_id, env_id, role_id, role_update, opts = {})
  data, _status_code, _headers = update_role_with_http_info(proj_id, env_id, role_id, role_update, opts)
  data
end

#update_role_with_http_info(proj_id, env_id, role_id, role_update, opts = {}) ⇒ Array<(RoleRead, Integer, Hash)>

Update Role Partially updates a tenant role. Fields that will be provided will be completely overwritten.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • role_update (RoleUpdate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RoleRead, Integer, Hash)>)

    RoleRead data, response status code and response headers



694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
# File 'lib/openapi_client/api/roles_api.rb', line 694

def update_role_with_http_info(proj_id, env_id, role_id, role_update, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RolesApi.update_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling RolesApi.update_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling RolesApi.update_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesApi.update_role"
  end
  # verify the required parameter 'role_update' is set
  if @api_client.config.client_side_validation && role_update.nil?
    fail ArgumentError, "Missing the required parameter 'role_update' when calling RolesApi.update_role"
  end
  # resource path
  local_var_path = '/v2/schema/{proj_id}/{env_id}/roles/{role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(role_update)

  # return_type
  return_type = opts[:debug_return_type] || 'RoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"RolesApi.update_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RolesApi#update_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end