stackone_client 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stack_one/accounts.rb +279 -36
  3. data/lib/stack_one/ats.rb +4075 -580
  4. data/lib/stack_one/connect_sessions.rb +123 -22
  5. data/lib/stack_one/connectors.rb +111 -14
  6. data/lib/stack_one/crm.rb +563 -78
  7. data/lib/stack_one/hris.rb +3401 -458
  8. data/lib/stack_one/iam.rb +675 -56
  9. data/lib/stack_one/lms.rb +1533 -220
  10. data/lib/stack_one/marketing.rb +1503 -230
  11. data/lib/stack_one/models/operations/hris_update_employee_time_off_request_request.rb +33 -0
  12. data/lib/stack_one/models/operations/hris_update_employee_time_off_request_response.rb +36 -0
  13. data/lib/stack_one/models/operations/iam_delete_user_request.rb +27 -0
  14. data/lib/stack_one/models/operations/iam_delete_user_response.rb +36 -0
  15. data/lib/stack_one/models/operations/iam_update_user_request.rb +30 -0
  16. data/lib/stack_one/models/operations/iam_update_user_response.rb +36 -0
  17. data/lib/stack_one/models/operations/lms_list_users_queryparam_filter.rb +5 -2
  18. data/lib/stack_one/models/operations.rb +6 -0
  19. data/lib/stack_one/models/shared/atscreatejobrequestdto.rb +5 -2
  20. data/lib/stack_one/models/shared/atsupdatejobrequestdto.rb +5 -2
  21. data/lib/stack_one/models/shared/hriscreatetimeoffrequestdto.rb +2 -0
  22. data/lib/stack_one/models/shared/hriscreatetimeoffrequestdto_type.rb +2 -0
  23. data/lib/stack_one/models/shared/iamupdateuserrequestdto.rb +45 -0
  24. data/lib/stack_one/models/shared/iamupdateuserrequestdto_status.rb +27 -0
  25. data/lib/stack_one/models/shared/iamupdateuserrequestdto_value.rb +20 -0
  26. data/lib/stack_one/models/shared/job.rb +5 -2
  27. data/lib/stack_one/models/shared/rawresponse.rb +2 -2
  28. data/lib/stack_one/models/shared/timeoff.rb +2 -0
  29. data/lib/stack_one/models/shared/timeoff_type.rb +2 -0
  30. data/lib/stack_one/models/shared/updateuserapimodel.rb +45 -0
  31. data/lib/stack_one/models/shared/updateuserapimodel_status.rb +27 -0
  32. data/lib/stack_one/models/shared/updateuserapimodel_value.rb +20 -0
  33. data/lib/stack_one/models/shared.rb +6 -0
  34. data/lib/stack_one/proxy.rb +62 -11
  35. data/lib/stack_one/sdk_hooks/hooks.rb +101 -0
  36. data/lib/stack_one/sdk_hooks/types.rb +152 -0
  37. data/lib/stack_one/sdkconfiguration.rb +11 -4
  38. data/lib/stack_one/stackone.rb +22 -8
  39. data/lib/stack_one/utils/utils.rb +10 -0
  40. metadata +16 -2
data/lib/stack_one/iam.rb CHANGED
@@ -7,6 +7,7 @@ require 'faraday'
7
7
  require 'faraday/multipart'
8
8
  require 'faraday/retry'
9
9
  require 'sorbet-runtime'
10
+ require_relative 'sdk_hooks/hooks'
10
11
  require_relative 'utils/retries'
11
12
 
12
13
  module StackOne
@@ -21,8 +22,119 @@ module StackOne
21
22
  end
22
23
 
23
24
 
24
- sig { params(request: T.nilable(::StackOne::Operations::IamGetGroupRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamGetGroupResponse) }
25
- def get_group(request, retries = nil)
25
+ sig { params(id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamDeleteUserResponse) }
26
+ def delete_user(id, x_account_id, retries = nil, timeout_ms = nil)
27
+ # delete_user - Delete User
28
+ request = ::StackOne::Operations::IamDeleteUserRequest.new(
29
+
30
+ id: id,
31
+ x_account_id: x_account_id
32
+ )
33
+ url, params = @sdk_configuration.get_server_details
34
+ base_url = Utils.template_url(url, params)
35
+ url = Utils.generate_url(
36
+ ::StackOne::Operations::IamDeleteUserRequest,
37
+ base_url,
38
+ '/unified/iam/users/{id}',
39
+ request
40
+ )
41
+ headers = Utils.get_headers(request)
42
+ headers['Accept'] = 'application/json'
43
+ headers['user-agent'] = @sdk_configuration.user_agent
44
+ retries ||= @sdk_configuration.retry_config
45
+ retries ||= Utils::RetryConfig.new(
46
+ backoff: Utils::BackoffStrategy.new(
47
+ exponent: 1.5,
48
+ initial_interval: 500,
49
+ max_elapsed_time: 3_600_000,
50
+ max_interval: 60_000
51
+ ),
52
+ retry_connection_errors: true,
53
+ strategy: 'backoff'
54
+ )
55
+ retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
56
+ retry_options[:retry_statuses] = [429, 408]
57
+
58
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
59
+
60
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
61
+ timeout ||= @sdk_configuration.timeout
62
+
63
+ connection = @sdk_configuration.client.dup
64
+ connection.request :retry, retry_options
65
+
66
+ hook_ctx = SDKHooks::HookContext.new(
67
+ base_url: base_url,
68
+ oauth2_scopes: [],
69
+ operation_id: 'iam_delete_user',
70
+ security_source: @sdk_configuration.security_source
71
+ )
72
+
73
+ error = T.let(nil, T.nilable(StandardError))
74
+ r = T.let(nil, T.nilable(Faraday::Response))
75
+
76
+ begin
77
+ r = connection.delete(url) do |req|
78
+ req.headers.merge!(headers)
79
+ req.options.timeout = timeout unless timeout.nil?
80
+ Utils.configure_request_security(req, security)
81
+
82
+ @sdk_configuration.hooks.before_request(
83
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
84
+ hook_ctx: hook_ctx
85
+ ),
86
+ request: req
87
+ )
88
+ end
89
+ rescue StandardError => e
90
+ error = e
91
+ ensure
92
+ if r.nil? || Utils.error_status?(r.status)
93
+ r = @sdk_configuration.hooks.after_error(
94
+ error: error,
95
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
96
+ hook_ctx: hook_ctx
97
+ ),
98
+ response: r
99
+ )
100
+ else
101
+ r = @sdk_configuration.hooks.after_success(
102
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
103
+ hook_ctx: hook_ctx
104
+ ),
105
+ response: r
106
+ )
107
+ end
108
+
109
+ if r.nil?
110
+ raise error if !error.nil?
111
+ raise 'no response'
112
+ end
113
+ end
114
+
115
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
116
+
117
+ res = ::StackOne::Operations::IamDeleteUserResponse.new(
118
+ status_code: r.status, content_type: content_type, raw_response: r
119
+ )
120
+ if r.status == 200
121
+ if Utils.match_content_type(content_type, 'application/json')
122
+ out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::StackOne::Shared::DeleteResult)
123
+ res.delete_result = out
124
+ end
125
+ elsif r.status == 204
126
+ elsif r.status == 408
127
+ res.headers = r.headers
128
+ elsif [400, 403, 412, 429].include?(r.status)
129
+ elsif [500, 501].include?(r.status)
130
+ end
131
+
132
+ res
133
+ end
134
+
135
+
136
+ sig { params(request: T.nilable(::StackOne::Operations::IamGetGroupRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamGetGroupResponse) }
137
+ def get_group(request, retries = nil, timeout_ms = nil)
26
138
  # get_group - Get Group
27
139
  url, params = @sdk_configuration.get_server_details
28
140
  base_url = Utils.template_url(url, params)
@@ -50,14 +162,62 @@ module StackOne
50
162
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
51
163
  retry_options[:retry_statuses] = [429, 408]
52
164
 
165
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
166
+
167
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
168
+ timeout ||= @sdk_configuration.timeout
169
+
53
170
  connection = @sdk_configuration.client.dup
54
171
  connection.request :retry, retry_options
55
172
 
56
- r = connection.get(url) do |req|
57
- req.headers = headers
58
- req.params = query_params
59
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
60
- Utils.configure_request_security(req, security) if !security.nil?
173
+ hook_ctx = SDKHooks::HookContext.new(
174
+ base_url: base_url,
175
+ oauth2_scopes: [],
176
+ operation_id: 'iam_get_group',
177
+ security_source: @sdk_configuration.security_source
178
+ )
179
+
180
+ error = T.let(nil, T.nilable(StandardError))
181
+ r = T.let(nil, T.nilable(Faraday::Response))
182
+
183
+ begin
184
+ r = connection.get(url) do |req|
185
+ req.headers.merge!(headers)
186
+ req.options.timeout = timeout unless timeout.nil?
187
+ req.params = query_params
188
+ Utils.configure_request_security(req, security)
189
+
190
+ @sdk_configuration.hooks.before_request(
191
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
192
+ hook_ctx: hook_ctx
193
+ ),
194
+ request: req
195
+ )
196
+ end
197
+ rescue StandardError => e
198
+ error = e
199
+ ensure
200
+ if r.nil? || Utils.error_status?(r.status)
201
+ r = @sdk_configuration.hooks.after_error(
202
+ error: error,
203
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
204
+ hook_ctx: hook_ctx
205
+ ),
206
+ response: r
207
+ )
208
+ else
209
+ r = @sdk_configuration.hooks.after_success(
210
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
211
+ hook_ctx: hook_ctx
212
+ ),
213
+ response: r
214
+ )
215
+ end
216
+
217
+ if r.nil?
218
+ raise error if !error.nil?
219
+ raise 'no response'
220
+ end
61
221
  end
62
222
 
63
223
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -80,8 +240,8 @@ module StackOne
80
240
  end
81
241
 
82
242
 
83
- sig { params(request: T.nilable(::StackOne::Operations::IamGetPolicyRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamGetPolicyResponse) }
84
- def get_policy(request, retries = nil)
243
+ sig { params(request: T.nilable(::StackOne::Operations::IamGetPolicyRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamGetPolicyResponse) }
244
+ def get_policy(request, retries = nil, timeout_ms = nil)
85
245
  # get_policy - Get Policy
86
246
  url, params = @sdk_configuration.get_server_details
87
247
  base_url = Utils.template_url(url, params)
@@ -109,14 +269,62 @@ module StackOne
109
269
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
110
270
  retry_options[:retry_statuses] = [429, 408]
111
271
 
272
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
273
+
274
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
275
+ timeout ||= @sdk_configuration.timeout
276
+
112
277
  connection = @sdk_configuration.client.dup
113
278
  connection.request :retry, retry_options
114
279
 
115
- r = connection.get(url) do |req|
116
- req.headers = headers
117
- req.params = query_params
118
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
119
- Utils.configure_request_security(req, security) if !security.nil?
280
+ hook_ctx = SDKHooks::HookContext.new(
281
+ base_url: base_url,
282
+ oauth2_scopes: [],
283
+ operation_id: 'iam_get_policy',
284
+ security_source: @sdk_configuration.security_source
285
+ )
286
+
287
+ error = T.let(nil, T.nilable(StandardError))
288
+ r = T.let(nil, T.nilable(Faraday::Response))
289
+
290
+ begin
291
+ r = connection.get(url) do |req|
292
+ req.headers.merge!(headers)
293
+ req.options.timeout = timeout unless timeout.nil?
294
+ req.params = query_params
295
+ Utils.configure_request_security(req, security)
296
+
297
+ @sdk_configuration.hooks.before_request(
298
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
299
+ hook_ctx: hook_ctx
300
+ ),
301
+ request: req
302
+ )
303
+ end
304
+ rescue StandardError => e
305
+ error = e
306
+ ensure
307
+ if r.nil? || Utils.error_status?(r.status)
308
+ r = @sdk_configuration.hooks.after_error(
309
+ error: error,
310
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
311
+ hook_ctx: hook_ctx
312
+ ),
313
+ response: r
314
+ )
315
+ else
316
+ r = @sdk_configuration.hooks.after_success(
317
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
318
+ hook_ctx: hook_ctx
319
+ ),
320
+ response: r
321
+ )
322
+ end
323
+
324
+ if r.nil?
325
+ raise error if !error.nil?
326
+ raise 'no response'
327
+ end
120
328
  end
121
329
 
122
330
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -139,8 +347,8 @@ module StackOne
139
347
  end
140
348
 
141
349
 
142
- sig { params(request: T.nilable(::StackOne::Operations::IamGetRoleRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamGetRoleResponse) }
143
- def get_role(request, retries = nil)
350
+ sig { params(request: T.nilable(::StackOne::Operations::IamGetRoleRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamGetRoleResponse) }
351
+ def get_role(request, retries = nil, timeout_ms = nil)
144
352
  # get_role - Get Role
145
353
  url, params = @sdk_configuration.get_server_details
146
354
  base_url = Utils.template_url(url, params)
@@ -168,14 +376,62 @@ module StackOne
168
376
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
169
377
  retry_options[:retry_statuses] = [429, 408]
170
378
 
379
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
380
+
381
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
382
+ timeout ||= @sdk_configuration.timeout
383
+
171
384
  connection = @sdk_configuration.client.dup
172
385
  connection.request :retry, retry_options
173
386
 
174
- r = connection.get(url) do |req|
175
- req.headers = headers
176
- req.params = query_params
177
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
178
- Utils.configure_request_security(req, security) if !security.nil?
387
+ hook_ctx = SDKHooks::HookContext.new(
388
+ base_url: base_url,
389
+ oauth2_scopes: [],
390
+ operation_id: 'iam_get_role',
391
+ security_source: @sdk_configuration.security_source
392
+ )
393
+
394
+ error = T.let(nil, T.nilable(StandardError))
395
+ r = T.let(nil, T.nilable(Faraday::Response))
396
+
397
+ begin
398
+ r = connection.get(url) do |req|
399
+ req.headers.merge!(headers)
400
+ req.options.timeout = timeout unless timeout.nil?
401
+ req.params = query_params
402
+ Utils.configure_request_security(req, security)
403
+
404
+ @sdk_configuration.hooks.before_request(
405
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
406
+ hook_ctx: hook_ctx
407
+ ),
408
+ request: req
409
+ )
410
+ end
411
+ rescue StandardError => e
412
+ error = e
413
+ ensure
414
+ if r.nil? || Utils.error_status?(r.status)
415
+ r = @sdk_configuration.hooks.after_error(
416
+ error: error,
417
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
418
+ hook_ctx: hook_ctx
419
+ ),
420
+ response: r
421
+ )
422
+ else
423
+ r = @sdk_configuration.hooks.after_success(
424
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
425
+ hook_ctx: hook_ctx
426
+ ),
427
+ response: r
428
+ )
429
+ end
430
+
431
+ if r.nil?
432
+ raise error if !error.nil?
433
+ raise 'no response'
434
+ end
179
435
  end
180
436
 
181
437
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -198,8 +454,8 @@ module StackOne
198
454
  end
199
455
 
200
456
 
201
- sig { params(request: T.nilable(::StackOne::Operations::IamGetUserRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamGetUserResponse) }
202
- def get_user(request, retries = nil)
457
+ sig { params(request: T.nilable(::StackOne::Operations::IamGetUserRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamGetUserResponse) }
458
+ def get_user(request, retries = nil, timeout_ms = nil)
203
459
  # get_user - Get User
204
460
  url, params = @sdk_configuration.get_server_details
205
461
  base_url = Utils.template_url(url, params)
@@ -227,14 +483,62 @@ module StackOne
227
483
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
228
484
  retry_options[:retry_statuses] = [429, 408]
229
485
 
486
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
487
+
488
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
489
+ timeout ||= @sdk_configuration.timeout
490
+
230
491
  connection = @sdk_configuration.client.dup
231
492
  connection.request :retry, retry_options
232
493
 
233
- r = connection.get(url) do |req|
234
- req.headers = headers
235
- req.params = query_params
236
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
237
- Utils.configure_request_security(req, security) if !security.nil?
494
+ hook_ctx = SDKHooks::HookContext.new(
495
+ base_url: base_url,
496
+ oauth2_scopes: [],
497
+ operation_id: 'iam_get_user',
498
+ security_source: @sdk_configuration.security_source
499
+ )
500
+
501
+ error = T.let(nil, T.nilable(StandardError))
502
+ r = T.let(nil, T.nilable(Faraday::Response))
503
+
504
+ begin
505
+ r = connection.get(url) do |req|
506
+ req.headers.merge!(headers)
507
+ req.options.timeout = timeout unless timeout.nil?
508
+ req.params = query_params
509
+ Utils.configure_request_security(req, security)
510
+
511
+ @sdk_configuration.hooks.before_request(
512
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
513
+ hook_ctx: hook_ctx
514
+ ),
515
+ request: req
516
+ )
517
+ end
518
+ rescue StandardError => e
519
+ error = e
520
+ ensure
521
+ if r.nil? || Utils.error_status?(r.status)
522
+ r = @sdk_configuration.hooks.after_error(
523
+ error: error,
524
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
525
+ hook_ctx: hook_ctx
526
+ ),
527
+ response: r
528
+ )
529
+ else
530
+ r = @sdk_configuration.hooks.after_success(
531
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
532
+ hook_ctx: hook_ctx
533
+ ),
534
+ response: r
535
+ )
536
+ end
537
+
538
+ if r.nil?
539
+ raise error if !error.nil?
540
+ raise 'no response'
541
+ end
238
542
  end
239
543
 
240
544
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -257,8 +561,8 @@ module StackOne
257
561
  end
258
562
 
259
563
 
260
- sig { params(request: T.nilable(::StackOne::Operations::IamListGroupsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamListGroupsResponse) }
261
- def list_groups(request, retries = nil)
564
+ sig { params(request: T.nilable(::StackOne::Operations::IamListGroupsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamListGroupsResponse) }
565
+ def list_groups(request, retries = nil, timeout_ms = nil)
262
566
  # list_groups - List Groups
263
567
  url, params = @sdk_configuration.get_server_details
264
568
  base_url = Utils.template_url(url, params)
@@ -281,14 +585,62 @@ module StackOne
281
585
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
282
586
  retry_options[:retry_statuses] = [429, 408]
283
587
 
588
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
589
+
590
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
591
+ timeout ||= @sdk_configuration.timeout
592
+
284
593
  connection = @sdk_configuration.client.dup
285
594
  connection.request :retry, retry_options
286
595
 
287
- r = connection.get(url) do |req|
288
- req.headers = headers
289
- req.params = query_params
290
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
291
- Utils.configure_request_security(req, security) if !security.nil?
596
+ hook_ctx = SDKHooks::HookContext.new(
597
+ base_url: base_url,
598
+ oauth2_scopes: [],
599
+ operation_id: 'iam_list_groups',
600
+ security_source: @sdk_configuration.security_source
601
+ )
602
+
603
+ error = T.let(nil, T.nilable(StandardError))
604
+ r = T.let(nil, T.nilable(Faraday::Response))
605
+
606
+ begin
607
+ r = connection.get(url) do |req|
608
+ req.headers.merge!(headers)
609
+ req.options.timeout = timeout unless timeout.nil?
610
+ req.params = query_params
611
+ Utils.configure_request_security(req, security)
612
+
613
+ @sdk_configuration.hooks.before_request(
614
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
615
+ hook_ctx: hook_ctx
616
+ ),
617
+ request: req
618
+ )
619
+ end
620
+ rescue StandardError => e
621
+ error = e
622
+ ensure
623
+ if r.nil? || Utils.error_status?(r.status)
624
+ r = @sdk_configuration.hooks.after_error(
625
+ error: error,
626
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
627
+ hook_ctx: hook_ctx
628
+ ),
629
+ response: r
630
+ )
631
+ else
632
+ r = @sdk_configuration.hooks.after_success(
633
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
634
+ hook_ctx: hook_ctx
635
+ ),
636
+ response: r
637
+ )
638
+ end
639
+
640
+ if r.nil?
641
+ raise error if !error.nil?
642
+ raise 'no response'
643
+ end
292
644
  end
293
645
 
294
646
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -311,8 +663,8 @@ module StackOne
311
663
  end
312
664
 
313
665
 
314
- sig { params(request: T.nilable(::StackOne::Operations::IamListPoliciesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamListPoliciesResponse) }
315
- def list_policies(request, retries = nil)
666
+ sig { params(request: T.nilable(::StackOne::Operations::IamListPoliciesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamListPoliciesResponse) }
667
+ def list_policies(request, retries = nil, timeout_ms = nil)
316
668
  # list_policies - List Policies
317
669
  url, params = @sdk_configuration.get_server_details
318
670
  base_url = Utils.template_url(url, params)
@@ -335,14 +687,62 @@ module StackOne
335
687
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
336
688
  retry_options[:retry_statuses] = [429, 408]
337
689
 
690
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
691
+
692
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
693
+ timeout ||= @sdk_configuration.timeout
694
+
338
695
  connection = @sdk_configuration.client.dup
339
696
  connection.request :retry, retry_options
340
697
 
341
- r = connection.get(url) do |req|
342
- req.headers = headers
343
- req.params = query_params
344
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
345
- Utils.configure_request_security(req, security) if !security.nil?
698
+ hook_ctx = SDKHooks::HookContext.new(
699
+ base_url: base_url,
700
+ oauth2_scopes: [],
701
+ operation_id: 'iam_list_policies',
702
+ security_source: @sdk_configuration.security_source
703
+ )
704
+
705
+ error = T.let(nil, T.nilable(StandardError))
706
+ r = T.let(nil, T.nilable(Faraday::Response))
707
+
708
+ begin
709
+ r = connection.get(url) do |req|
710
+ req.headers.merge!(headers)
711
+ req.options.timeout = timeout unless timeout.nil?
712
+ req.params = query_params
713
+ Utils.configure_request_security(req, security)
714
+
715
+ @sdk_configuration.hooks.before_request(
716
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
717
+ hook_ctx: hook_ctx
718
+ ),
719
+ request: req
720
+ )
721
+ end
722
+ rescue StandardError => e
723
+ error = e
724
+ ensure
725
+ if r.nil? || Utils.error_status?(r.status)
726
+ r = @sdk_configuration.hooks.after_error(
727
+ error: error,
728
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
729
+ hook_ctx: hook_ctx
730
+ ),
731
+ response: r
732
+ )
733
+ else
734
+ r = @sdk_configuration.hooks.after_success(
735
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
736
+ hook_ctx: hook_ctx
737
+ ),
738
+ response: r
739
+ )
740
+ end
741
+
742
+ if r.nil?
743
+ raise error if !error.nil?
744
+ raise 'no response'
745
+ end
346
746
  end
347
747
 
348
748
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -365,8 +765,8 @@ module StackOne
365
765
  end
366
766
 
367
767
 
368
- sig { params(request: T.nilable(::StackOne::Operations::IamListRolesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamListRolesResponse) }
369
- def list_roles(request, retries = nil)
768
+ sig { params(request: T.nilable(::StackOne::Operations::IamListRolesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamListRolesResponse) }
769
+ def list_roles(request, retries = nil, timeout_ms = nil)
370
770
  # list_roles - List Roles
371
771
  url, params = @sdk_configuration.get_server_details
372
772
  base_url = Utils.template_url(url, params)
@@ -389,14 +789,62 @@ module StackOne
389
789
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
390
790
  retry_options[:retry_statuses] = [429, 408]
391
791
 
792
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
793
+
794
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
795
+ timeout ||= @sdk_configuration.timeout
796
+
392
797
  connection = @sdk_configuration.client.dup
393
798
  connection.request :retry, retry_options
394
799
 
395
- r = connection.get(url) do |req|
396
- req.headers = headers
397
- req.params = query_params
398
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
399
- Utils.configure_request_security(req, security) if !security.nil?
800
+ hook_ctx = SDKHooks::HookContext.new(
801
+ base_url: base_url,
802
+ oauth2_scopes: [],
803
+ operation_id: 'iam_list_roles',
804
+ security_source: @sdk_configuration.security_source
805
+ )
806
+
807
+ error = T.let(nil, T.nilable(StandardError))
808
+ r = T.let(nil, T.nilable(Faraday::Response))
809
+
810
+ begin
811
+ r = connection.get(url) do |req|
812
+ req.headers.merge!(headers)
813
+ req.options.timeout = timeout unless timeout.nil?
814
+ req.params = query_params
815
+ Utils.configure_request_security(req, security)
816
+
817
+ @sdk_configuration.hooks.before_request(
818
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
819
+ hook_ctx: hook_ctx
820
+ ),
821
+ request: req
822
+ )
823
+ end
824
+ rescue StandardError => e
825
+ error = e
826
+ ensure
827
+ if r.nil? || Utils.error_status?(r.status)
828
+ r = @sdk_configuration.hooks.after_error(
829
+ error: error,
830
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
831
+ hook_ctx: hook_ctx
832
+ ),
833
+ response: r
834
+ )
835
+ else
836
+ r = @sdk_configuration.hooks.after_success(
837
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
838
+ hook_ctx: hook_ctx
839
+ ),
840
+ response: r
841
+ )
842
+ end
843
+
844
+ if r.nil?
845
+ raise error if !error.nil?
846
+ raise 'no response'
847
+ end
400
848
  end
401
849
 
402
850
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -419,8 +867,8 @@ module StackOne
419
867
  end
420
868
 
421
869
 
422
- sig { params(request: T.nilable(::StackOne::Operations::IamListUsersRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::IamListUsersResponse) }
423
- def list_users(request, retries = nil)
870
+ sig { params(request: T.nilable(::StackOne::Operations::IamListUsersRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamListUsersResponse) }
871
+ def list_users(request, retries = nil, timeout_ms = nil)
424
872
  # list_users - List Users
425
873
  url, params = @sdk_configuration.get_server_details
426
874
  base_url = Utils.template_url(url, params)
@@ -443,14 +891,62 @@ module StackOne
443
891
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
444
892
  retry_options[:retry_statuses] = [429, 408]
445
893
 
894
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
895
+
896
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
897
+ timeout ||= @sdk_configuration.timeout
898
+
446
899
  connection = @sdk_configuration.client.dup
447
900
  connection.request :retry, retry_options
448
901
 
449
- r = connection.get(url) do |req|
450
- req.headers = headers
451
- req.params = query_params
452
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
453
- Utils.configure_request_security(req, security) if !security.nil?
902
+ hook_ctx = SDKHooks::HookContext.new(
903
+ base_url: base_url,
904
+ oauth2_scopes: [],
905
+ operation_id: 'iam_list_users',
906
+ security_source: @sdk_configuration.security_source
907
+ )
908
+
909
+ error = T.let(nil, T.nilable(StandardError))
910
+ r = T.let(nil, T.nilable(Faraday::Response))
911
+
912
+ begin
913
+ r = connection.get(url) do |req|
914
+ req.headers.merge!(headers)
915
+ req.options.timeout = timeout unless timeout.nil?
916
+ req.params = query_params
917
+ Utils.configure_request_security(req, security)
918
+
919
+ @sdk_configuration.hooks.before_request(
920
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
921
+ hook_ctx: hook_ctx
922
+ ),
923
+ request: req
924
+ )
925
+ end
926
+ rescue StandardError => e
927
+ error = e
928
+ ensure
929
+ if r.nil? || Utils.error_status?(r.status)
930
+ r = @sdk_configuration.hooks.after_error(
931
+ error: error,
932
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
933
+ hook_ctx: hook_ctx
934
+ ),
935
+ response: r
936
+ )
937
+ else
938
+ r = @sdk_configuration.hooks.after_success(
939
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
940
+ hook_ctx: hook_ctx
941
+ ),
942
+ response: r
943
+ )
944
+ end
945
+
946
+ if r.nil?
947
+ raise error if !error.nil?
948
+ raise 'no response'
949
+ end
454
950
  end
455
951
 
456
952
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -471,5 +967,128 @@ module StackOne
471
967
 
472
968
  res
473
969
  end
970
+
971
+
972
+ sig { params(iam_update_user_request_dto: ::StackOne::Shared::IamUpdateUserRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::IamUpdateUserResponse) }
973
+ def update_user(iam_update_user_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
974
+ # update_user - Update User
975
+ request = ::StackOne::Operations::IamUpdateUserRequest.new(
976
+
977
+ iam_update_user_request_dto: iam_update_user_request_dto,
978
+ id: id,
979
+ x_account_id: x_account_id
980
+ )
981
+ url, params = @sdk_configuration.get_server_details
982
+ base_url = Utils.template_url(url, params)
983
+ url = Utils.generate_url(
984
+ ::StackOne::Operations::IamUpdateUserRequest,
985
+ base_url,
986
+ '/unified/iam/users/{id}',
987
+ request
988
+ )
989
+ headers = Utils.get_headers(request)
990
+ req_content_type, data, form = Utils.serialize_request_body(request, :iam_update_user_request_dto, :json)
991
+ headers['content-type'] = req_content_type
992
+ raise StandardError, 'request body is required' if data.nil? && form.nil?
993
+
994
+ if form
995
+ body = Utils.encode_form(form)
996
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
997
+ body = URI.encode_www_form(data)
998
+ else
999
+ body = data
1000
+ end
1001
+ headers['Accept'] = 'application/json'
1002
+ headers['user-agent'] = @sdk_configuration.user_agent
1003
+ retries ||= @sdk_configuration.retry_config
1004
+ retries ||= Utils::RetryConfig.new(
1005
+ backoff: Utils::BackoffStrategy.new(
1006
+ exponent: 1.5,
1007
+ initial_interval: 500,
1008
+ max_elapsed_time: 3_600_000,
1009
+ max_interval: 60_000
1010
+ ),
1011
+ retry_connection_errors: true,
1012
+ strategy: 'backoff'
1013
+ )
1014
+ retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1015
+ retry_options[:retry_statuses] = [429, 408]
1016
+
1017
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1018
+
1019
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1020
+ timeout ||= @sdk_configuration.timeout
1021
+
1022
+ connection = @sdk_configuration.client.dup
1023
+ connection.request :retry, retry_options
1024
+
1025
+ hook_ctx = SDKHooks::HookContext.new(
1026
+ base_url: base_url,
1027
+ oauth2_scopes: [],
1028
+ operation_id: 'iam_update_user',
1029
+ security_source: @sdk_configuration.security_source
1030
+ )
1031
+
1032
+ error = T.let(nil, T.nilable(StandardError))
1033
+ r = T.let(nil, T.nilable(Faraday::Response))
1034
+
1035
+ begin
1036
+ r = connection.patch(url) do |req|
1037
+ req.body = body
1038
+ req.headers.merge!(headers)
1039
+ req.options.timeout = timeout unless timeout.nil?
1040
+ Utils.configure_request_security(req, security)
1041
+
1042
+ @sdk_configuration.hooks.before_request(
1043
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1044
+ hook_ctx: hook_ctx
1045
+ ),
1046
+ request: req
1047
+ )
1048
+ end
1049
+ rescue StandardError => e
1050
+ error = e
1051
+ ensure
1052
+ if r.nil? || Utils.error_status?(r.status)
1053
+ r = @sdk_configuration.hooks.after_error(
1054
+ error: error,
1055
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1056
+ hook_ctx: hook_ctx
1057
+ ),
1058
+ response: r
1059
+ )
1060
+ else
1061
+ r = @sdk_configuration.hooks.after_success(
1062
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1063
+ hook_ctx: hook_ctx
1064
+ ),
1065
+ response: r
1066
+ )
1067
+ end
1068
+
1069
+ if r.nil?
1070
+ raise error if !error.nil?
1071
+ raise 'no response'
1072
+ end
1073
+ end
1074
+
1075
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
1076
+
1077
+ res = ::StackOne::Operations::IamUpdateUserResponse.new(
1078
+ status_code: r.status, content_type: content_type, raw_response: r
1079
+ )
1080
+ if r.status == 200
1081
+ if Utils.match_content_type(content_type, 'application/json')
1082
+ out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::StackOne::Shared::UpdateUserApiModel)
1083
+ res.update_user_api_model = out
1084
+ end
1085
+ elsif r.status == 408
1086
+ res.headers = r.headers
1087
+ elsif [400, 403, 412, 429].include?(r.status)
1088
+ elsif [500, 501].include?(r.status)
1089
+ end
1090
+
1091
+ res
1092
+ end
474
1093
  end
475
1094
  end