noresponse 7.0.5 → 7.1.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.
- checksums.yaml +4 -4
- data/lib/no_response/keys.rb +866 -0
- data/lib/no_response/models/operations/createkey_request.rb +37 -0
- data/lib/no_response/models/operations/createkey_request.rbi +20 -0
- data/lib/no_response/models/operations/createkey_response.rb +32 -0
- data/lib/no_response/models/operations/createkey_response.rbi +20 -0
- data/lib/no_response/models/operations/getsettings_request.rb +41 -0
- data/lib/no_response/models/operations/getsettings_request.rbi +20 -0
- data/lib/no_response/models/operations/getsettings_response.rb +32 -0
- data/lib/no_response/models/operations/getsettings_response.rbi +20 -0
- data/lib/no_response/models/operations/listkeys_request.rb +33 -0
- data/lib/no_response/models/operations/listkeys_request.rbi +14 -0
- data/lib/no_response/models/operations/listkeys_response.rb +32 -0
- data/lib/no_response/models/operations/listkeys_response.rbi +20 -0
- data/lib/no_response/models/operations/revokekey_request.rb +37 -0
- data/lib/no_response/models/operations/revokekey_request.rbi +20 -0
- data/lib/no_response/models/operations/revokekey_response.rb +32 -0
- data/lib/no_response/models/operations/revokekey_response.rbi +20 -0
- data/lib/no_response/models/operations/updatesettings_request.rb +52 -0
- data/lib/no_response/models/operations/updatesettings_request.rbi +26 -0
- data/lib/no_response/models/operations/updatesettings_response.rb +32 -0
- data/lib/no_response/models/operations/updatesettings_response.rbi +20 -0
- data/lib/no_response/models/operations.rb +10 -0
- data/lib/no_response/models/shared/admission.rb +19 -0
- data/lib/no_response/models/shared/admission.rbi +9 -0
- data/lib/no_response/models/shared/conflicterrorcode.rb +2 -0
- data/lib/no_response/models/shared/defaultdepth.rb +19 -0
- data/lib/no_response/models/shared/defaultdepth.rbi +9 -0
- data/lib/no_response/models/shared/flowchange.rb +136 -0
- data/lib/no_response/models/shared/flowchange.rbi +62 -0
- data/lib/no_response/models/shared/flowsettings.rb +127 -0
- data/lib/no_response/models/shared/flowsettings.rbi +56 -0
- data/lib/no_response/models/shared/key.rb +158 -0
- data/lib/no_response/models/shared/key.rbi +80 -0
- data/lib/no_response/models/shared/{scope.rb → key_scope.rb} +2 -1
- data/lib/no_response/models/shared/{scope.rbi → key_scope.rbi} +2 -2
- data/lib/no_response/models/shared/keyenvironment.rb +19 -0
- data/lib/no_response/models/shared/keyenvironment.rbi +9 -0
- data/lib/no_response/models/shared/keylist.rb +32 -0
- data/lib/no_response/models/shared/keylist.rbi +14 -0
- data/lib/no_response/models/shared/keyrequest.rb +49 -0
- data/lib/no_response/models/shared/keyrequest.rbi +20 -0
- data/lib/no_response/models/shared/keyrequest_scope.rb +21 -0
- data/lib/no_response/models/shared/keyrequest_scope.rbi +9 -0
- data/lib/no_response/models/shared/keyrotation.rb +2 -2
- data/lib/no_response/models/shared/keyrotation_scope.rb +24 -0
- data/lib/no_response/models/shared/keyrotation_scope.rbi +9 -0
- data/lib/no_response/models/shared/keystatus.rb +20 -0
- data/lib/no_response/models/shared/keystatus.rbi +9 -0
- data/lib/no_response/models/shared/onexpiry.rb +20 -0
- data/lib/no_response/models/shared/onexpiry.rbi +9 -0
- data/lib/no_response/models/shared/permissiondeniederrorcode.rb +1 -0
- data/lib/no_response/models/shared/settings.rb +116 -0
- data/lib/no_response/models/shared/settings.rbi +56 -0
- data/lib/no_response/models/shared/settingsflows.rb +56 -0
- data/lib/no_response/models/shared/settingsflows.rbi +26 -0
- data/lib/no_response/models/shared/settingsrequest.rb +55 -0
- data/lib/no_response/models/shared/settingsrequest.rbi +26 -0
- data/lib/no_response/models/shared/settingsrequestflows.rb +65 -0
- data/lib/no_response/models/shared/settingsrequestflows.rbi +32 -0
- data/lib/no_response/models/shared/sourceid.rb +23 -0
- data/lib/no_response/models/shared/sourceid.rbi +9 -0
- data/lib/no_response/models/shared.rb +18 -1
- data/lib/no_response/noresponseclient.rb +2 -1
- data/lib/no_response/sdkconfiguration.rb +2 -2
- data/lib/no_response/settings.rb +633 -0
- data/lib/noresponse.rb +1 -0
- metadata +58 -3
data/lib/no_response/keys.rb
CHANGED
|
@@ -314,5 +314,871 @@ module NoResponse
|
|
|
314
314
|
|
|
315
315
|
end
|
|
316
316
|
end
|
|
317
|
+
|
|
318
|
+
sig {
|
|
319
|
+
params(
|
|
320
|
+
body: Models::Shared::KeyRequest,
|
|
321
|
+
workspace_id: ::String,
|
|
322
|
+
timeout_ms: T.nilable(Integer),
|
|
323
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
324
|
+
)
|
|
325
|
+
.returns(Models::Operations::CreateKeyResponse)
|
|
326
|
+
}
|
|
327
|
+
def create(body:, workspace_id:, timeout_ms: nil, http_headers: nil)
|
|
328
|
+
# create - Create an API key.
|
|
329
|
+
# Creates an API key in the environment of the key that signs the request, with scopes that key holds itself, and returns its secret once in key. Requires the management scope; the new key may hold it too. A scope the signing key lacks answers 403 workspace_forbidden, and the other environment 404 not_found. An environment holds at most 100 keys that authenticate (409 key_limit_reached). created_by is the signing key's prefix. Not idempotent: a retry after a lost answer creates a second key, which you can list and revoke.
|
|
330
|
+
request = Models::Operations::CreateKeyRequest.new(
|
|
331
|
+
workspace_id: workspace_id,
|
|
332
|
+
body: body
|
|
333
|
+
)
|
|
334
|
+
url, params = @sdk_configuration.get_server_details
|
|
335
|
+
base_url = Utils.template_url(url, params)
|
|
336
|
+
url = Utils.generate_url(
|
|
337
|
+
Models::Operations::CreateKeyRequest,
|
|
338
|
+
base_url,
|
|
339
|
+
"/v1/workspaces/{workspace_id}/keys",
|
|
340
|
+
request
|
|
341
|
+
)
|
|
342
|
+
headers = {}
|
|
343
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
344
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
345
|
+
headers["content-type"] = req_content_type
|
|
346
|
+
raise StandardError, "request body is required" if data.nil? && form.nil?
|
|
347
|
+
|
|
348
|
+
if form && !form.empty?
|
|
349
|
+
body = Utils.encode_form(form)
|
|
350
|
+
elsif Utils.match_content_type(req_content_type, "application/x-www-form-urlencoded")
|
|
351
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
352
|
+
else
|
|
353
|
+
body = data
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
headers["Accept"] = "application/json"
|
|
357
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
358
|
+
|
|
359
|
+
security = @sdk_configuration.security_source&.call
|
|
360
|
+
|
|
361
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
362
|
+
timeout ||= @sdk_configuration.timeout
|
|
363
|
+
|
|
364
|
+
connection = @sdk_configuration.client
|
|
365
|
+
|
|
366
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
367
|
+
config: @sdk_configuration,
|
|
368
|
+
base_url: base_url,
|
|
369
|
+
oauth2_scopes: nil,
|
|
370
|
+
operation_id: "createKey",
|
|
371
|
+
security_source: @sdk_configuration.security_source
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
375
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
376
|
+
|
|
377
|
+
begin
|
|
378
|
+
http_response = T.must(connection).post(url) do |req|
|
|
379
|
+
req.body = body
|
|
380
|
+
req.headers.merge!(headers)
|
|
381
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
382
|
+
Utils.configure_request_security(req, security)
|
|
383
|
+
http_headers&.each do |key, value|
|
|
384
|
+
req.headers[key.to_s] = value
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
@sdk_configuration.hooks.before_request(
|
|
388
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
389
|
+
hook_ctx: hook_ctx
|
|
390
|
+
),
|
|
391
|
+
request: req
|
|
392
|
+
)
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
rescue StandardError => e
|
|
396
|
+
error = e
|
|
397
|
+
ensure
|
|
398
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
399
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
400
|
+
error: error,
|
|
401
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
402
|
+
hook_ctx: hook_ctx
|
|
403
|
+
),
|
|
404
|
+
response: http_response
|
|
405
|
+
)
|
|
406
|
+
else
|
|
407
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
408
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
409
|
+
hook_ctx: hook_ctx
|
|
410
|
+
),
|
|
411
|
+
response: http_response
|
|
412
|
+
)
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
if http_response.nil?
|
|
416
|
+
raise error if !error.nil?
|
|
417
|
+
raise "no response"
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
422
|
+
if Utils.match_status_code(http_response.status, ["201"])
|
|
423
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
424
|
+
@sdk_configuration.hooks.after_success(
|
|
425
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
426
|
+
hook_ctx: hook_ctx
|
|
427
|
+
),
|
|
428
|
+
response: http_response
|
|
429
|
+
)
|
|
430
|
+
response_data = http_response.env.response_body
|
|
431
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::Key)
|
|
432
|
+
result = obj
|
|
433
|
+
response = Models::Operations::CreateKeyResponse.new(
|
|
434
|
+
result: result,
|
|
435
|
+
headers: http_response.headers
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
return response
|
|
439
|
+
else
|
|
440
|
+
raise(
|
|
441
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
442
|
+
status_code: http_response.status,
|
|
443
|
+
body: http_response.env.response_body,
|
|
444
|
+
raw_response: http_response
|
|
445
|
+
),
|
|
446
|
+
"Unknown content type received"
|
|
447
|
+
)
|
|
448
|
+
end
|
|
449
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
450
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
451
|
+
@sdk_configuration.hooks.after_success(
|
|
452
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
453
|
+
hook_ctx: hook_ctx
|
|
454
|
+
),
|
|
455
|
+
response: http_response
|
|
456
|
+
)
|
|
457
|
+
response_data = http_response.env.response_body
|
|
458
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
459
|
+
raise obj
|
|
460
|
+
else
|
|
461
|
+
raise(
|
|
462
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
463
|
+
status_code: http_response.status,
|
|
464
|
+
body: http_response.env.response_body,
|
|
465
|
+
raw_response: http_response
|
|
466
|
+
),
|
|
467
|
+
"Unknown content type received"
|
|
468
|
+
)
|
|
469
|
+
end
|
|
470
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
471
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
472
|
+
@sdk_configuration.hooks.after_success(
|
|
473
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
474
|
+
hook_ctx: hook_ctx
|
|
475
|
+
),
|
|
476
|
+
response: http_response
|
|
477
|
+
)
|
|
478
|
+
response_data = http_response.env.response_body
|
|
479
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
480
|
+
raise obj
|
|
481
|
+
else
|
|
482
|
+
raise(
|
|
483
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
484
|
+
status_code: http_response.status,
|
|
485
|
+
body: http_response.env.response_body,
|
|
486
|
+
raw_response: http_response
|
|
487
|
+
),
|
|
488
|
+
"Unknown content type received"
|
|
489
|
+
)
|
|
490
|
+
end
|
|
491
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
492
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
493
|
+
@sdk_configuration.hooks.after_success(
|
|
494
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
495
|
+
hook_ctx: hook_ctx
|
|
496
|
+
),
|
|
497
|
+
response: http_response
|
|
498
|
+
)
|
|
499
|
+
response_data = http_response.env.response_body
|
|
500
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
501
|
+
raise obj
|
|
502
|
+
else
|
|
503
|
+
raise(
|
|
504
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
505
|
+
status_code: http_response.status,
|
|
506
|
+
body: http_response.env.response_body,
|
|
507
|
+
raw_response: http_response
|
|
508
|
+
),
|
|
509
|
+
"Unknown content type received"
|
|
510
|
+
)
|
|
511
|
+
end
|
|
512
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
513
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
514
|
+
@sdk_configuration.hooks.after_success(
|
|
515
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
516
|
+
hook_ctx: hook_ctx
|
|
517
|
+
),
|
|
518
|
+
response: http_response
|
|
519
|
+
)
|
|
520
|
+
response_data = http_response.env.response_body
|
|
521
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
522
|
+
raise obj
|
|
523
|
+
else
|
|
524
|
+
raise(
|
|
525
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
526
|
+
status_code: http_response.status,
|
|
527
|
+
body: http_response.env.response_body,
|
|
528
|
+
raw_response: http_response
|
|
529
|
+
),
|
|
530
|
+
"Unknown content type received"
|
|
531
|
+
)
|
|
532
|
+
end
|
|
533
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
534
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
535
|
+
@sdk_configuration.hooks.after_success(
|
|
536
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
537
|
+
hook_ctx: hook_ctx
|
|
538
|
+
),
|
|
539
|
+
response: http_response
|
|
540
|
+
)
|
|
541
|
+
response_data = http_response.env.response_body
|
|
542
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
543
|
+
raise obj
|
|
544
|
+
else
|
|
545
|
+
raise(
|
|
546
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
547
|
+
status_code: http_response.status,
|
|
548
|
+
body: http_response.env.response_body,
|
|
549
|
+
raw_response: http_response
|
|
550
|
+
),
|
|
551
|
+
"Unknown content type received"
|
|
552
|
+
)
|
|
553
|
+
end
|
|
554
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
555
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
556
|
+
@sdk_configuration.hooks.after_success(
|
|
557
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
558
|
+
hook_ctx: hook_ctx
|
|
559
|
+
),
|
|
560
|
+
response: http_response
|
|
561
|
+
)
|
|
562
|
+
response_data = http_response.env.response_body
|
|
563
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
564
|
+
raise obj
|
|
565
|
+
else
|
|
566
|
+
raise(
|
|
567
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
568
|
+
status_code: http_response.status,
|
|
569
|
+
body: http_response.env.response_body,
|
|
570
|
+
raw_response: http_response
|
|
571
|
+
),
|
|
572
|
+
"Unknown content type received"
|
|
573
|
+
)
|
|
574
|
+
end
|
|
575
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
576
|
+
raise(
|
|
577
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
578
|
+
status_code: http_response.status,
|
|
579
|
+
body: http_response.env.response_body,
|
|
580
|
+
raw_response: http_response
|
|
581
|
+
),
|
|
582
|
+
"API error occurred"
|
|
583
|
+
)
|
|
584
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
585
|
+
raise(
|
|
586
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
587
|
+
status_code: http_response.status,
|
|
588
|
+
body: http_response.env.response_body,
|
|
589
|
+
raw_response: http_response
|
|
590
|
+
),
|
|
591
|
+
"API error occurred"
|
|
592
|
+
)
|
|
593
|
+
else
|
|
594
|
+
raise(
|
|
595
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
596
|
+
status_code: http_response.status,
|
|
597
|
+
body: http_response.env.response_body,
|
|
598
|
+
raw_response: http_response
|
|
599
|
+
),
|
|
600
|
+
"Unknown status code received"
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
end
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
sig {
|
|
607
|
+
params(
|
|
608
|
+
workspace_id: ::String,
|
|
609
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
610
|
+
timeout_ms: T.nilable(Integer),
|
|
611
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
612
|
+
)
|
|
613
|
+
.returns(Models::Operations::ListKeysResponse)
|
|
614
|
+
}
|
|
615
|
+
def list(workspace_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
616
|
+
# list - List API keys.
|
|
617
|
+
# Lists the keys of the signing key's environment, newest first, at most 200, revoked and expired keys included, without secrets: each key's id, prefix, scopes, status, and who created and revoked it. Requires the management scope. Read-only and safe to retry.
|
|
618
|
+
request = Models::Operations::ListKeysRequest.new(
|
|
619
|
+
workspace_id: workspace_id
|
|
620
|
+
)
|
|
621
|
+
url, params = @sdk_configuration.get_server_details
|
|
622
|
+
base_url = Utils.template_url(url, params)
|
|
623
|
+
url = Utils.generate_url(
|
|
624
|
+
Models::Operations::ListKeysRequest,
|
|
625
|
+
base_url,
|
|
626
|
+
"/v1/workspaces/{workspace_id}/keys",
|
|
627
|
+
request
|
|
628
|
+
)
|
|
629
|
+
headers = {}
|
|
630
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
631
|
+
headers["Accept"] = "application/json"
|
|
632
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
633
|
+
retries ||= @sdk_configuration.retry_config
|
|
634
|
+
retries ||= Utils::RetryConfig.new(
|
|
635
|
+
backoff: Utils::BackoffStrategy.new(
|
|
636
|
+
exponent: 2.0,
|
|
637
|
+
initial_interval: 500,
|
|
638
|
+
max_elapsed_time: 30_000,
|
|
639
|
+
max_interval: 8000
|
|
640
|
+
),
|
|
641
|
+
retry_connection_errors: true,
|
|
642
|
+
strategy: "backoff"
|
|
643
|
+
)
|
|
644
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
645
|
+
retry_options[:retry_statuses] = [408, 429, 500, 501, 502, 503, 504, 505]
|
|
646
|
+
|
|
647
|
+
security = @sdk_configuration.security_source&.call
|
|
648
|
+
|
|
649
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
650
|
+
timeout ||= @sdk_configuration.timeout
|
|
651
|
+
|
|
652
|
+
connection = @sdk_configuration.client.dup
|
|
653
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
654
|
+
|
|
655
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
656
|
+
config: @sdk_configuration,
|
|
657
|
+
base_url: base_url,
|
|
658
|
+
oauth2_scopes: nil,
|
|
659
|
+
operation_id: "listKeys",
|
|
660
|
+
security_source: @sdk_configuration.security_source
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
664
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
665
|
+
|
|
666
|
+
begin
|
|
667
|
+
http_response = T.must(connection).get(url) do |req|
|
|
668
|
+
req.headers.merge!(headers)
|
|
669
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
670
|
+
Utils.configure_request_security(req, security)
|
|
671
|
+
http_headers&.each do |key, value|
|
|
672
|
+
req.headers[key.to_s] = value
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
@sdk_configuration.hooks.before_request(
|
|
676
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
677
|
+
hook_ctx: hook_ctx
|
|
678
|
+
),
|
|
679
|
+
request: req
|
|
680
|
+
)
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
rescue StandardError => e
|
|
684
|
+
error = e
|
|
685
|
+
ensure
|
|
686
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
687
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
688
|
+
error: error,
|
|
689
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
690
|
+
hook_ctx: hook_ctx
|
|
691
|
+
),
|
|
692
|
+
response: http_response
|
|
693
|
+
)
|
|
694
|
+
else
|
|
695
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
696
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
697
|
+
hook_ctx: hook_ctx
|
|
698
|
+
),
|
|
699
|
+
response: http_response
|
|
700
|
+
)
|
|
701
|
+
end
|
|
702
|
+
|
|
703
|
+
if http_response.nil?
|
|
704
|
+
raise error if !error.nil?
|
|
705
|
+
raise "no response"
|
|
706
|
+
end
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
710
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
711
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
712
|
+
@sdk_configuration.hooks.after_success(
|
|
713
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
714
|
+
hook_ctx: hook_ctx
|
|
715
|
+
),
|
|
716
|
+
response: http_response
|
|
717
|
+
)
|
|
718
|
+
response_data = http_response.env.response_body
|
|
719
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::KeyList)
|
|
720
|
+
result = obj
|
|
721
|
+
response = Models::Operations::ListKeysResponse.new(
|
|
722
|
+
result: result,
|
|
723
|
+
headers: http_response.headers
|
|
724
|
+
)
|
|
725
|
+
|
|
726
|
+
return response
|
|
727
|
+
else
|
|
728
|
+
raise(
|
|
729
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
730
|
+
status_code: http_response.status,
|
|
731
|
+
body: http_response.env.response_body,
|
|
732
|
+
raw_response: http_response
|
|
733
|
+
),
|
|
734
|
+
"Unknown content type received"
|
|
735
|
+
)
|
|
736
|
+
end
|
|
737
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
738
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
739
|
+
@sdk_configuration.hooks.after_success(
|
|
740
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
741
|
+
hook_ctx: hook_ctx
|
|
742
|
+
),
|
|
743
|
+
response: http_response
|
|
744
|
+
)
|
|
745
|
+
response_data = http_response.env.response_body
|
|
746
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
747
|
+
raise obj
|
|
748
|
+
else
|
|
749
|
+
raise(
|
|
750
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
751
|
+
status_code: http_response.status,
|
|
752
|
+
body: http_response.env.response_body,
|
|
753
|
+
raw_response: http_response
|
|
754
|
+
),
|
|
755
|
+
"Unknown content type received"
|
|
756
|
+
)
|
|
757
|
+
end
|
|
758
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
759
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
760
|
+
@sdk_configuration.hooks.after_success(
|
|
761
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
762
|
+
hook_ctx: hook_ctx
|
|
763
|
+
),
|
|
764
|
+
response: http_response
|
|
765
|
+
)
|
|
766
|
+
response_data = http_response.env.response_body
|
|
767
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
768
|
+
raise obj
|
|
769
|
+
else
|
|
770
|
+
raise(
|
|
771
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
772
|
+
status_code: http_response.status,
|
|
773
|
+
body: http_response.env.response_body,
|
|
774
|
+
raw_response: http_response
|
|
775
|
+
),
|
|
776
|
+
"Unknown content type received"
|
|
777
|
+
)
|
|
778
|
+
end
|
|
779
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
780
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
781
|
+
@sdk_configuration.hooks.after_success(
|
|
782
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
783
|
+
hook_ctx: hook_ctx
|
|
784
|
+
),
|
|
785
|
+
response: http_response
|
|
786
|
+
)
|
|
787
|
+
response_data = http_response.env.response_body
|
|
788
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
789
|
+
raise obj
|
|
790
|
+
else
|
|
791
|
+
raise(
|
|
792
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
793
|
+
status_code: http_response.status,
|
|
794
|
+
body: http_response.env.response_body,
|
|
795
|
+
raw_response: http_response
|
|
796
|
+
),
|
|
797
|
+
"Unknown content type received"
|
|
798
|
+
)
|
|
799
|
+
end
|
|
800
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
801
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
802
|
+
@sdk_configuration.hooks.after_success(
|
|
803
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
804
|
+
hook_ctx: hook_ctx
|
|
805
|
+
),
|
|
806
|
+
response: http_response
|
|
807
|
+
)
|
|
808
|
+
response_data = http_response.env.response_body
|
|
809
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
810
|
+
raise obj
|
|
811
|
+
else
|
|
812
|
+
raise(
|
|
813
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
814
|
+
status_code: http_response.status,
|
|
815
|
+
body: http_response.env.response_body,
|
|
816
|
+
raw_response: http_response
|
|
817
|
+
),
|
|
818
|
+
"Unknown content type received"
|
|
819
|
+
)
|
|
820
|
+
end
|
|
821
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
822
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
823
|
+
@sdk_configuration.hooks.after_success(
|
|
824
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
825
|
+
hook_ctx: hook_ctx
|
|
826
|
+
),
|
|
827
|
+
response: http_response
|
|
828
|
+
)
|
|
829
|
+
response_data = http_response.env.response_body
|
|
830
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
831
|
+
raise obj
|
|
832
|
+
else
|
|
833
|
+
raise(
|
|
834
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
835
|
+
status_code: http_response.status,
|
|
836
|
+
body: http_response.env.response_body,
|
|
837
|
+
raw_response: http_response
|
|
838
|
+
),
|
|
839
|
+
"Unknown content type received"
|
|
840
|
+
)
|
|
841
|
+
end
|
|
842
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
843
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
844
|
+
@sdk_configuration.hooks.after_success(
|
|
845
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
846
|
+
hook_ctx: hook_ctx
|
|
847
|
+
),
|
|
848
|
+
response: http_response
|
|
849
|
+
)
|
|
850
|
+
response_data = http_response.env.response_body
|
|
851
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
852
|
+
raise obj
|
|
853
|
+
else
|
|
854
|
+
raise(
|
|
855
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
856
|
+
status_code: http_response.status,
|
|
857
|
+
body: http_response.env.response_body,
|
|
858
|
+
raw_response: http_response
|
|
859
|
+
),
|
|
860
|
+
"Unknown content type received"
|
|
861
|
+
)
|
|
862
|
+
end
|
|
863
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
864
|
+
raise(
|
|
865
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
866
|
+
status_code: http_response.status,
|
|
867
|
+
body: http_response.env.response_body,
|
|
868
|
+
raw_response: http_response
|
|
869
|
+
),
|
|
870
|
+
"API error occurred"
|
|
871
|
+
)
|
|
872
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
873
|
+
raise(
|
|
874
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
875
|
+
status_code: http_response.status,
|
|
876
|
+
body: http_response.env.response_body,
|
|
877
|
+
raw_response: http_response
|
|
878
|
+
),
|
|
879
|
+
"API error occurred"
|
|
880
|
+
)
|
|
881
|
+
else
|
|
882
|
+
raise(
|
|
883
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
884
|
+
status_code: http_response.status,
|
|
885
|
+
body: http_response.env.response_body,
|
|
886
|
+
raw_response: http_response
|
|
887
|
+
),
|
|
888
|
+
"Unknown status code received"
|
|
889
|
+
)
|
|
890
|
+
|
|
891
|
+
end
|
|
892
|
+
end
|
|
893
|
+
|
|
894
|
+
sig {
|
|
895
|
+
params(
|
|
896
|
+
workspace_id: ::String,
|
|
897
|
+
key_id: ::String,
|
|
898
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
899
|
+
timeout_ms: T.nilable(Integer),
|
|
900
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
901
|
+
)
|
|
902
|
+
.returns(Models::Operations::RevokeKeyResponse)
|
|
903
|
+
}
|
|
904
|
+
def revoke(workspace_id:, key_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
905
|
+
# revoke - Revoke an API key.
|
|
906
|
+
# Revokes a key of the signing key's environment at once: its next request answers 401. Requires the management scope. A key of the other environment or of another workspace answers 404 not_found. A key cannot revoke itself (409 self_revocation): rotate it with keys.rotate, or revoke it with another management key. Revoking a revoked key changes nothing and answers the key as it was revoked, so a retry is safe.
|
|
907
|
+
request = Models::Operations::RevokeKeyRequest.new(
|
|
908
|
+
workspace_id: workspace_id,
|
|
909
|
+
key_id: key_id
|
|
910
|
+
)
|
|
911
|
+
url, params = @sdk_configuration.get_server_details
|
|
912
|
+
base_url = Utils.template_url(url, params)
|
|
913
|
+
url = Utils.generate_url(
|
|
914
|
+
Models::Operations::RevokeKeyRequest,
|
|
915
|
+
base_url,
|
|
916
|
+
"/v1/workspaces/{workspace_id}/keys/{key_id}",
|
|
917
|
+
request
|
|
918
|
+
)
|
|
919
|
+
headers = {}
|
|
920
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
921
|
+
headers["Accept"] = "application/json"
|
|
922
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
923
|
+
retries ||= @sdk_configuration.retry_config
|
|
924
|
+
retries ||= Utils::RetryConfig.new(
|
|
925
|
+
backoff: Utils::BackoffStrategy.new(
|
|
926
|
+
exponent: 2.0,
|
|
927
|
+
initial_interval: 500,
|
|
928
|
+
max_elapsed_time: 30_000,
|
|
929
|
+
max_interval: 8000
|
|
930
|
+
),
|
|
931
|
+
retry_connection_errors: true,
|
|
932
|
+
strategy: "backoff"
|
|
933
|
+
)
|
|
934
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
935
|
+
retry_options[:retry_statuses] = [408, 429, 500, 501, 502, 503, 504, 505]
|
|
936
|
+
|
|
937
|
+
security = @sdk_configuration.security_source&.call
|
|
938
|
+
|
|
939
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
940
|
+
timeout ||= @sdk_configuration.timeout
|
|
941
|
+
|
|
942
|
+
connection = @sdk_configuration.client.dup
|
|
943
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
944
|
+
|
|
945
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
946
|
+
config: @sdk_configuration,
|
|
947
|
+
base_url: base_url,
|
|
948
|
+
oauth2_scopes: nil,
|
|
949
|
+
operation_id: "revokeKey",
|
|
950
|
+
security_source: @sdk_configuration.security_source
|
|
951
|
+
)
|
|
952
|
+
|
|
953
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
954
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
955
|
+
|
|
956
|
+
begin
|
|
957
|
+
http_response = T.must(connection).delete(url) do |req|
|
|
958
|
+
req.headers.merge!(headers)
|
|
959
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
960
|
+
Utils.configure_request_security(req, security)
|
|
961
|
+
http_headers&.each do |key, value|
|
|
962
|
+
req.headers[key.to_s] = value
|
|
963
|
+
end
|
|
964
|
+
|
|
965
|
+
@sdk_configuration.hooks.before_request(
|
|
966
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
967
|
+
hook_ctx: hook_ctx
|
|
968
|
+
),
|
|
969
|
+
request: req
|
|
970
|
+
)
|
|
971
|
+
end
|
|
972
|
+
|
|
973
|
+
rescue StandardError => e
|
|
974
|
+
error = e
|
|
975
|
+
ensure
|
|
976
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
977
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
978
|
+
error: error,
|
|
979
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
980
|
+
hook_ctx: hook_ctx
|
|
981
|
+
),
|
|
982
|
+
response: http_response
|
|
983
|
+
)
|
|
984
|
+
else
|
|
985
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
986
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
987
|
+
hook_ctx: hook_ctx
|
|
988
|
+
),
|
|
989
|
+
response: http_response
|
|
990
|
+
)
|
|
991
|
+
end
|
|
992
|
+
|
|
993
|
+
if http_response.nil?
|
|
994
|
+
raise error if !error.nil?
|
|
995
|
+
raise "no response"
|
|
996
|
+
end
|
|
997
|
+
end
|
|
998
|
+
|
|
999
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
1000
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
1001
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
1002
|
+
@sdk_configuration.hooks.after_success(
|
|
1003
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1004
|
+
hook_ctx: hook_ctx
|
|
1005
|
+
),
|
|
1006
|
+
response: http_response
|
|
1007
|
+
)
|
|
1008
|
+
response_data = http_response.env.response_body
|
|
1009
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::Key)
|
|
1010
|
+
result = obj
|
|
1011
|
+
response = Models::Operations::RevokeKeyResponse.new(
|
|
1012
|
+
result: result,
|
|
1013
|
+
headers: http_response.headers
|
|
1014
|
+
)
|
|
1015
|
+
|
|
1016
|
+
return response
|
|
1017
|
+
else
|
|
1018
|
+
raise(
|
|
1019
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1020
|
+
status_code: http_response.status,
|
|
1021
|
+
body: http_response.env.response_body,
|
|
1022
|
+
raw_response: http_response
|
|
1023
|
+
),
|
|
1024
|
+
"Unknown content type received"
|
|
1025
|
+
)
|
|
1026
|
+
end
|
|
1027
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
1028
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
1029
|
+
@sdk_configuration.hooks.after_success(
|
|
1030
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1031
|
+
hook_ctx: hook_ctx
|
|
1032
|
+
),
|
|
1033
|
+
response: http_response
|
|
1034
|
+
)
|
|
1035
|
+
response_data = http_response.env.response_body
|
|
1036
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
1037
|
+
raise obj
|
|
1038
|
+
else
|
|
1039
|
+
raise(
|
|
1040
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1041
|
+
status_code: http_response.status,
|
|
1042
|
+
body: http_response.env.response_body,
|
|
1043
|
+
raw_response: http_response
|
|
1044
|
+
),
|
|
1045
|
+
"Unknown content type received"
|
|
1046
|
+
)
|
|
1047
|
+
end
|
|
1048
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
1049
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
1050
|
+
@sdk_configuration.hooks.after_success(
|
|
1051
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1052
|
+
hook_ctx: hook_ctx
|
|
1053
|
+
),
|
|
1054
|
+
response: http_response
|
|
1055
|
+
)
|
|
1056
|
+
response_data = http_response.env.response_body
|
|
1057
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
1058
|
+
raise obj
|
|
1059
|
+
else
|
|
1060
|
+
raise(
|
|
1061
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1062
|
+
status_code: http_response.status,
|
|
1063
|
+
body: http_response.env.response_body,
|
|
1064
|
+
raw_response: http_response
|
|
1065
|
+
),
|
|
1066
|
+
"Unknown content type received"
|
|
1067
|
+
)
|
|
1068
|
+
end
|
|
1069
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
1070
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
1071
|
+
@sdk_configuration.hooks.after_success(
|
|
1072
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1073
|
+
hook_ctx: hook_ctx
|
|
1074
|
+
),
|
|
1075
|
+
response: http_response
|
|
1076
|
+
)
|
|
1077
|
+
response_data = http_response.env.response_body
|
|
1078
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
1079
|
+
raise obj
|
|
1080
|
+
else
|
|
1081
|
+
raise(
|
|
1082
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1083
|
+
status_code: http_response.status,
|
|
1084
|
+
body: http_response.env.response_body,
|
|
1085
|
+
raw_response: http_response
|
|
1086
|
+
),
|
|
1087
|
+
"Unknown content type received"
|
|
1088
|
+
)
|
|
1089
|
+
end
|
|
1090
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
1091
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
1092
|
+
@sdk_configuration.hooks.after_success(
|
|
1093
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1094
|
+
hook_ctx: hook_ctx
|
|
1095
|
+
),
|
|
1096
|
+
response: http_response
|
|
1097
|
+
)
|
|
1098
|
+
response_data = http_response.env.response_body
|
|
1099
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
1100
|
+
raise obj
|
|
1101
|
+
else
|
|
1102
|
+
raise(
|
|
1103
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1104
|
+
status_code: http_response.status,
|
|
1105
|
+
body: http_response.env.response_body,
|
|
1106
|
+
raw_response: http_response
|
|
1107
|
+
),
|
|
1108
|
+
"Unknown content type received"
|
|
1109
|
+
)
|
|
1110
|
+
end
|
|
1111
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
1112
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
1113
|
+
@sdk_configuration.hooks.after_success(
|
|
1114
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1115
|
+
hook_ctx: hook_ctx
|
|
1116
|
+
),
|
|
1117
|
+
response: http_response
|
|
1118
|
+
)
|
|
1119
|
+
response_data = http_response.env.response_body
|
|
1120
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
1121
|
+
raise obj
|
|
1122
|
+
else
|
|
1123
|
+
raise(
|
|
1124
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1125
|
+
status_code: http_response.status,
|
|
1126
|
+
body: http_response.env.response_body,
|
|
1127
|
+
raw_response: http_response
|
|
1128
|
+
),
|
|
1129
|
+
"Unknown content type received"
|
|
1130
|
+
)
|
|
1131
|
+
end
|
|
1132
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
1133
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
1134
|
+
@sdk_configuration.hooks.after_success(
|
|
1135
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1136
|
+
hook_ctx: hook_ctx
|
|
1137
|
+
),
|
|
1138
|
+
response: http_response
|
|
1139
|
+
)
|
|
1140
|
+
response_data = http_response.env.response_body
|
|
1141
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
1142
|
+
raise obj
|
|
1143
|
+
else
|
|
1144
|
+
raise(
|
|
1145
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1146
|
+
status_code: http_response.status,
|
|
1147
|
+
body: http_response.env.response_body,
|
|
1148
|
+
raw_response: http_response
|
|
1149
|
+
),
|
|
1150
|
+
"Unknown content type received"
|
|
1151
|
+
)
|
|
1152
|
+
end
|
|
1153
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
1154
|
+
raise(
|
|
1155
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1156
|
+
status_code: http_response.status,
|
|
1157
|
+
body: http_response.env.response_body,
|
|
1158
|
+
raw_response: http_response
|
|
1159
|
+
),
|
|
1160
|
+
"API error occurred"
|
|
1161
|
+
)
|
|
1162
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
1163
|
+
raise(
|
|
1164
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1165
|
+
status_code: http_response.status,
|
|
1166
|
+
body: http_response.env.response_body,
|
|
1167
|
+
raw_response: http_response
|
|
1168
|
+
),
|
|
1169
|
+
"API error occurred"
|
|
1170
|
+
)
|
|
1171
|
+
else
|
|
1172
|
+
raise(
|
|
1173
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
1174
|
+
status_code: http_response.status,
|
|
1175
|
+
body: http_response.env.response_body,
|
|
1176
|
+
raw_response: http_response
|
|
1177
|
+
),
|
|
1178
|
+
"Unknown status code received"
|
|
1179
|
+
)
|
|
1180
|
+
|
|
1181
|
+
end
|
|
1182
|
+
end
|
|
317
1183
|
end
|
|
318
1184
|
end
|