Class: Schematic::Accounts::Client
- Inherits:
-
Object
- Object
- Schematic::Accounts::Client
- Defined in:
- lib/schematic/accounts/client.rb
Instance Method Summary collapse
- #count_api_keys(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CountApiKeysResponse
- #count_audit_logs(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CountAuditLogsResponse
- #create_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CreateApiKeyResponse
- #create_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CreateEnvironmentResponse
- #delete_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::DeleteApiKeyResponse
- #delete_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::DeleteEnvironmentResponse
- #get_account_member(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetAccountMemberResponse
- #get_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetApiKeyResponse
- #get_audit_log(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetAuditLogResponse
- #get_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetEnvironmentResponse
- #get_who_am_i(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetWhoAmIResponse
- #initialize(client:) ⇒ void constructor
- #list_account_members(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListAccountMembersResponse
- #list_api_keys(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListApiKeysResponse
- #list_audit_logs(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListAuditLogsResponse
- #list_environments(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListEnvironmentsResponse
- #quickstart(request_options: {}, **params) ⇒ Schematic::Accounts::Types::QuickstartResponse
- #update_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::UpdateApiKeyResponse
- #update_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::UpdateEnvironmentResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/accounts/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#count_api_keys(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CountApiKeysResponse
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/schematic/accounts/client.rb', line 279 def count_api_keys(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[environment_id require_environment limit offset] query_params = {} query_params["environment_id"] = params[:environment_id] if params.key?(:environment_id) query_params["require_environment"] = params[:require_environment] if params.key?(:require_environment) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "api-keys/count", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::CountApiKeysResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_audit_logs(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CountAuditLogsResponse
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/schematic/accounts/client.rb', line 408 def count_audit_logs(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[actor_type end_time environment_id q start_time limit offset] query_params = {} query_params["actor_type"] = params[:actor_type] if params.key?(:actor_type) query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["environment_id"] = params[:environment_id] if params.key?(:environment_id) query_params["q"] = params[:q] if params.key?(:q) query_params["start_time"] = params[:start_time] if params.key?(:start_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "audit-log/count", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::CountAuditLogsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CreateApiKeyResponse
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/schematic/accounts/client.rb', line 142 def create_api_key(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "api-keys", body: Schematic::Accounts::Types::CreateApiKeyRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::CreateApiKeyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::CreateEnvironmentResponse
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
# File 'lib/schematic/accounts/client.rb', line 493 def create_environment(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "environments", body: Schematic::Accounts::Types::CreateEnvironmentRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::CreateEnvironmentResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::DeleteApiKeyResponse
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/schematic/accounts/client.rb', line 244 def delete_api_key(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::DeleteApiKeyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::DeleteEnvironmentResponse
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
# File 'lib/schematic/accounts/client.rb', line 595 def delete_environment(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::DeleteEnvironmentResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_account_member(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetAccountMemberResponse
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/schematic/accounts/client.rb', line 67 def get_account_member(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "account-members/#{URI.encode_uri_component(params[:account_member_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::GetAccountMemberResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetApiKeyResponse
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/schematic/accounts/client.rb', line 175 def get_api_key(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::GetApiKeyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_audit_log(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetAuditLogResponse
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/schematic/accounts/client.rb', line 370 def get_audit_log(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "audit-log/#{URI.encode_uri_component(params[:audit_log_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::GetAuditLogResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetEnvironmentResponse
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
# File 'lib/schematic/accounts/client.rb', line 526 def get_environment(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::GetEnvironmentResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_who_am_i(request_options: {}, **params) ⇒ Schematic::Accounts::Types::GetWhoAmIResponse
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
# File 'lib/schematic/accounts/client.rb', line 657 def get_who_am_i(request_options: {}, **params) Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "whoami", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::GetWhoAmIResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_account_members(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListAccountMembersResponse
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/schematic/accounts/client.rb', line 26 def list_account_members(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids q limit offset] query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["q"] = params[:q] if params.key?(:q) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "account-members", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::ListAccountMembersResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_api_keys(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListApiKeysResponse
102 103 104 105 106 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 |
# File 'lib/schematic/accounts/client.rb', line 102 def list_api_keys(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[environment_id require_environment limit offset] query_params = {} query_params["environment_id"] = params[:environment_id] if params.key?(:environment_id) query_params["require_environment"] = params[:require_environment] if params.key?(:require_environment) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "api-keys", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::ListApiKeysResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_audit_logs(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListAuditLogsResponse
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/schematic/accounts/client.rb', line 326 def list_audit_logs(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[actor_type end_time environment_id q start_time limit offset] query_params = {} query_params["actor_type"] = params[:actor_type] if params.key?(:actor_type) query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["environment_id"] = params[:environment_id] if params.key?(:environment_id) query_params["q"] = params[:q] if params.key?(:q) query_params["start_time"] = params[:start_time] if params.key?(:start_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "audit-log", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::ListAuditLogsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_environments(request_options: {}, **params) ⇒ Schematic::Accounts::Types::ListEnvironmentsResponse
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/schematic/accounts/client.rb', line 454 def list_environments(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids limit offset] query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "environments", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::ListEnvironmentsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#quickstart(request_options: {}, **params) ⇒ Schematic::Accounts::Types::QuickstartResponse
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
# File 'lib/schematic/accounts/client.rb', line 626 def quickstart(request_options: {}, **params) Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "quickstart", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::QuickstartResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_api_key(request_options: {}, **params) ⇒ Schematic::Accounts::Types::UpdateApiKeyResponse
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 |
# File 'lib/schematic/accounts/client.rb', line 207 def update_api_key(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Accounts::Types::UpdateApiKeyRequestBody.new(params).to_h non_body_param_names = ["api_key_id"] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::UpdateApiKeyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_environment(request_options: {}, **params) ⇒ Schematic::Accounts::Types::UpdateEnvironmentResponse
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/schematic/accounts/client.rb', line 558 def update_environment(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Accounts::Types::UpdateEnvironmentRequestBody.new(params).to_h non_body_param_names = ["environment_id"] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Accounts::Types::UpdateEnvironmentResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |