Class: RBACApiClient::CrossAccountRequestApi

Inherits:
Object
  • Object
show all
Defined in:
lib/insights-rbac-api-client/api/cross_account_request_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CrossAccountRequestApi

Returns a new instance of CrossAccountRequestApi.



19
20
21
# File 'lib/insights-rbac-api-client/api/cross_account_request_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/insights-rbac-api-client/api/cross_account_request_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_cross_account_requests(cross_account_request_in, opts = {}) ⇒ CrossAccountRequestOut

Create a cross account request

Parameters:

  • cross_account_request_in (CrossAccountRequestIn)

    CrossAccountRequest to create

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

    the optional parameters

Returns:



26
27
28
29
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 26

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#create_cross_account_requests_with_http_info(cross_account_request_in, opts = {}) ⇒ Array<(CrossAccountRequestOut, Integer, Hash)>

Create a cross account request

Parameters:

  • cross_account_request_in (CrossAccountRequestIn)

    CrossAccountRequest to create

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

    the optional parameters

Returns:

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

    CrossAccountRequestOut data, response status code and response headers



35
36
37
38
39
40
41
42
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
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 35

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CrossAccountRequestApi.create_cross_account_requests ...'
  end
  # verify the required parameter 'cross_account_request_in' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'cross_account_request_in' when calling CrossAccountRequestApi.create_cross_account_requests"
  end
  # resource path
  local_var_path = '/cross-account-requests/'

  # 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()

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

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

  new_options = opts.merge(
    :operation => :"CrossAccountRequestApi.create_cross_account_requests",
    :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: CrossAccountRequestApi#create_cross_account_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_cross_account_request(uuid, opts = {}) ⇒ CrossAccountRequestDetail

Get a cross account request

Parameters:

  • uuid (String)

    ID of cross account request to get

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

    the optional parameters

Options Hash (opts):

  • :query_by (String)

    Parameter for filtering resource by either a user&#39;s ID, or a client&#39;s org. The default value is target_org.

  • :account (String)

    Parameter for filtering resource by an account number. Value can be a comma-separated list of ids. To be used in tandem with ?query_by&#x3D;user_id to further filter a user&#39;s requests by account number.

  • :approved_only (String)

    Parameter for filtering resource which have been approved.

Returns:



95
96
97
98
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 95

def (uuid, opts = {})
  data, _status_code, _headers = (uuid, opts)
  data
end

#get_cross_account_request_with_http_info(uuid, opts = {}) ⇒ Array<(CrossAccountRequestDetail, Integer, Hash)>

Get a cross account request

Parameters:

  • uuid (String)

    ID of cross account request to get

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

    the optional parameters

Options Hash (opts):

  • :query_by (String)

    Parameter for filtering resource by either a user&#39;s ID, or a client&#39;s org. The default value is target_org.

  • :account (String)

    Parameter for filtering resource by an account number. Value can be a comma-separated list of ids. To be used in tandem with ?query_by&#x3D;user_id to further filter a user&#39;s requests by account number.

  • :approved_only (String)

    Parameter for filtering resource which have been approved.

Returns:

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

    CrossAccountRequestDetail data, response status code and response headers



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 107

def (uuid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CrossAccountRequestApi.get_cross_account_request ...'
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling CrossAccountRequestApi.get_cross_account_request"
  end
  allowable_values = ["user_id", "target_org"]
  if @api_client.config.client_side_validation && opts[:'query_by'] && !allowable_values.include?(opts[:'query_by'])
    fail ArgumentError, "invalid value for \"query_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["true"]
  if @api_client.config.client_side_validation && opts[:'approved_only'] && !allowable_values.include?(opts[:'approved_only'])
    fail ArgumentError, "invalid value for \"approved_only\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/cross-account-requests/{uuid}/'.sub('{' + 'uuid' + '}', CGI.escape(uuid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query_by'] = opts[:'query_by'] if !opts[:'query_by'].nil?
  query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?
  query_params[:'approved_only'] = opts[:'approved_only'] if !opts[:'approved_only'].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] || 'CrossAccountRequestDetail'

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

  new_options = opts.merge(
    :operation => :"CrossAccountRequestApi.get_cross_account_request",
    :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: CrossAccountRequestApi#get_cross_account_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_cross_account_requests(opts = {}) ⇒ CrossAccountRequestPagination

List the cross account requests for a user or account By default, responses are sorted in ascending order by created_at

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Parameter for selecting the amount of data returned. (default to 10)

  • :offset (Integer)

    Parameter for selecting the offset of data. (default to 0)

  • :query_by (String)

    Parameter for filtering resource by either a user&#39;s ID, or a client&#39;s org. The default value is target_org.

  • :account (String)

    Parameter for filtering resource by an account number. Value can be a comma-separated list of ids. To be used in tandem with ?query_by&#x3D;user_id to further filter a user&#39;s requests by account number.

  • :org_id (String)

    Parameter for filtering resource by an org id. Value can be a comma-separated list of ids. To be used in tandem with ?query_by&#x3D;user_id to further filter a user&#39;s requests by org id.

  • :approved_only (String)

    Parameter for filtering resource which have been approved.

  • :status (String)

    Parameter for filtering resource based on status.

  • :order_by (String)

    Parameter for ordering by field. For inverse ordering, use &#39;-&#39;, e.g. ?order_by&#x3D;-start_date.

Returns:



178
179
180
181
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 178

def (opts = {})
  data, _status_code, _headers = (opts)
  data
end

#list_cross_account_requests_with_http_info(opts = {}) ⇒ Array<(CrossAccountRequestPagination, Integer, Hash)>

List the cross account requests for a user or account By default, responses are sorted in ascending order by created_at

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Parameter for selecting the amount of data returned. (default to 10)

  • :offset (Integer)

    Parameter for selecting the offset of data. (default to 0)

  • :query_by (String)

    Parameter for filtering resource by either a user&#39;s ID, or a client&#39;s org. The default value is target_org.

  • :account (String)

    Parameter for filtering resource by an account number. Value can be a comma-separated list of ids. To be used in tandem with ?query_by&#x3D;user_id to further filter a user&#39;s requests by account number.

  • :org_id (String)

    Parameter for filtering resource by an org id. Value can be a comma-separated list of ids. To be used in tandem with ?query_by&#x3D;user_id to further filter a user&#39;s requests by org id.

  • :approved_only (String)

    Parameter for filtering resource which have been approved.

  • :status (String)

    Parameter for filtering resource based on status.

  • :order_by (String)

    Parameter for ordering by field. For inverse ordering, use &#39;-&#39;, e.g. ?order_by&#x3D;-start_date.

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
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
268
269
270
271
272
273
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 195

def (opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CrossAccountRequestApi.list_cross_account_requests ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CrossAccountRequestApi.list_cross_account_requests, must be smaller than or equal to 1000.'
  end

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

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

  allowable_values = ["user_id", "target_org"]
  if @api_client.config.client_side_validation && opts[:'query_by'] && !allowable_values.include?(opts[:'query_by'])
    fail ArgumentError, "invalid value for \"query_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["true"]
  if @api_client.config.client_side_validation && opts[:'approved_only'] && !allowable_values.include?(opts[:'approved_only'])
    fail ArgumentError, "invalid value for \"approved_only\", must be one of #{allowable_values}"
  end
  allowable_values = ["pending", "approved", "denied", "cancelled", "expired"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["request_id", "start_date", "end_date", "created", "modified", "status"]
  if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
    fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/cross-account-requests/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'query_by'] = opts[:'query_by'] if !opts[:'query_by'].nil?
  query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?
  query_params[:'org_id'] = opts[:'org_id'] if !opts[:'org_id'].nil?
  query_params[:'approved_only'] = opts[:'approved_only'] if !opts[:'approved_only'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].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] || 'CrossAccountRequestPagination'

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

  new_options = opts.merge(
    :operation => :"CrossAccountRequestApi.list_cross_account_requests",
    :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: CrossAccountRequestApi#list_cross_account_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_cross_account_request(uuid, cross_account_request_patch, opts = {}) ⇒ CrossAccountRequestDetail

Patch a cross account request Patch the start_date/end_date/roles of an existing request. Could be used by TAM requestor to cancel request or target account admin to approve/deny request.

Parameters:

  • uuid (String)

    ID of cross account request to get

  • cross_account_request_patch (CrossAccountRequestPatch)

    Updates to CrossAccountRequest

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

    the optional parameters

Returns:



281
282
283
284
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 281

def (uuid, , opts = {})
  data, _status_code, _headers = (uuid, , opts)
  data
end

#patch_cross_account_request_with_http_info(uuid, cross_account_request_patch, opts = {}) ⇒ Array<(CrossAccountRequestDetail, Integer, Hash)>

Patch a cross account request Patch the start_date/end_date/roles of an existing request. Could be used by TAM requestor to cancel request or target account admin to approve/deny request.

Parameters:

  • uuid (String)

    ID of cross account request to get

  • cross_account_request_patch (CrossAccountRequestPatch)

    Updates to CrossAccountRequest

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

    the optional parameters

Returns:

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

    CrossAccountRequestDetail data, response status code and response headers



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
343
344
345
346
347
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 292

def (uuid, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CrossAccountRequestApi.patch_cross_account_request ...'
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling CrossAccountRequestApi.patch_cross_account_request"
  end
  # verify the required parameter 'cross_account_request_patch' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'cross_account_request_patch' when calling CrossAccountRequestApi.patch_cross_account_request"
  end
  # resource path
  local_var_path = '/cross-account-requests/{uuid}/'.sub('{' + 'uuid' + '}', CGI.escape(uuid.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()

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

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

  new_options = opts.merge(
    :operation => :"CrossAccountRequestApi.patch_cross_account_request",
    :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: CrossAccountRequestApi#patch_cross_account_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_cross_account_request(uuid, cross_account_request_update_in, opts = {}) ⇒ CrossAccountRequestDetail

Update a cross account request For TAM requestor to update the start_date/end_date/roles of an existing cross account request.

Parameters:

  • uuid (String)

    ID of cross account request to get

  • cross_account_request_update_in (CrossAccountRequestUpdateIn)

    Updates to CrossAccountRequest

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

    the optional parameters

Returns:



355
356
357
358
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 355

def (uuid, , opts = {})
  data, _status_code, _headers = (uuid, , opts)
  data
end

#put_cross_account_request_with_http_info(uuid, cross_account_request_update_in, opts = {}) ⇒ Array<(CrossAccountRequestDetail, Integer, Hash)>

Update a cross account request For TAM requestor to update the start_date/end_date/roles of an existing cross account request.

Parameters:

  • uuid (String)

    ID of cross account request to get

  • cross_account_request_update_in (CrossAccountRequestUpdateIn)

    Updates to CrossAccountRequest

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

    the optional parameters

Returns:

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

    CrossAccountRequestDetail data, response status code and response headers



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
418
419
420
421
# File 'lib/insights-rbac-api-client/api/cross_account_request_api.rb', line 366

def (uuid, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CrossAccountRequestApi.put_cross_account_request ...'
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling CrossAccountRequestApi.put_cross_account_request"
  end
  # verify the required parameter 'cross_account_request_update_in' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'cross_account_request_update_in' when calling CrossAccountRequestApi.put_cross_account_request"
  end
  # resource path
  local_var_path = '/cross-account-requests/{uuid}/'.sub('{' + 'uuid' + '}', CGI.escape(uuid.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()

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

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

  new_options = opts.merge(
    :operation => :"CrossAccountRequestApi.put_cross_account_request",
    :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: CrossAccountRequestApi#put_cross_account_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end