ssoready 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +159 -0
- data/lib/ssoready/management/client.rb +51 -0
- data/lib/ssoready/management/organizations/client.rb +247 -0
- data/lib/ssoready/management/saml_connections/client.rb +269 -0
- data/lib/ssoready/management/scim_directories/client.rb +330 -0
- data/lib/ssoready/management/setup_urls/client.rb +97 -0
- data/lib/ssoready/saml/client.rb +170 -0
- data/lib/ssoready/scim/client.rb +296 -0
- data/lib/ssoready/types/create_organization_response.rb +63 -0
- data/lib/ssoready/types/create_saml_connection_response.rb +63 -0
- data/lib/ssoready/types/create_scim_directory_response.rb +63 -0
- data/lib/ssoready/types/create_setup_url_response.rb +62 -0
- data/lib/ssoready/types/get_organization_response.rb +63 -0
- data/lib/ssoready/types/get_saml_connection_response.rb +63 -0
- data/lib/ssoready/types/get_saml_redirect_url_response.rb +56 -0
- data/lib/ssoready/types/get_scim_directory_response.rb +63 -0
- data/lib/ssoready/types/get_scim_group_response.rb +63 -0
- data/lib/ssoready/types/get_scim_user_response.rb +63 -0
- data/lib/ssoready/types/google_protobuf_any.rb +58 -0
- data/lib/ssoready/types/list_organizations_response.rb +73 -0
- data/lib/ssoready/types/list_saml_connections_response.rb +73 -0
- data/lib/ssoready/types/list_scim_directories_response.rb +73 -0
- data/lib/ssoready/types/list_scim_groups_response.rb +73 -0
- data/lib/ssoready/types/list_scim_users_response.rb +73 -0
- data/lib/ssoready/types/organization.rb +112 -0
- data/lib/ssoready/types/redeem_saml_access_code_response.rb +126 -0
- data/lib/ssoready/types/rotate_scim_directory_bearer_token_response.rb +63 -0
- data/lib/ssoready/types/saml_connection.rb +144 -0
- data/lib/ssoready/types/scim_directory.rb +104 -0
- data/lib/ssoready/types/scim_group.rb +114 -0
- data/lib/ssoready/types/scim_user.rb +102 -0
- data/lib/ssoready/types/status.rb +94 -0
- data/lib/ssoready/types/update_organization_response.rb +63 -0
- data/lib/ssoready/types/update_saml_connection_response.rb +63 -0
- data/lib/ssoready/types/update_scim_directory_response.rb +63 -0
- data/lib/ssoready.rb +68 -0
- data/lib/types_export.rb +29 -0
- metadata +163 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eae7d3a91ffaa2a24a93694e881ad865dd00f9cb4567f657d37335975029ab0a
|
4
|
+
data.tar.gz: 405f5ab9bb277715d81ab9810491133c1cdebada999d72b44a4c3e8b4caf2c8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5ab8e8cade77237383875ecc23607ed64e7998cbcfd38f5b92ef7919ac3a0efabd63fea14661f8df3a37a852baf6e705df1455da6067518aa566f6ac5f15da2
|
7
|
+
data.tar.gz: 8edde9a2038c2af2f12cdbd63e75bb47098c5bd99c7ad9cfbeb45d1dba24b345e15593357abfd464e7e0b90c11f3b4dbf2f2dd87b40ac5990a924968ba12f7a4
|
data/lib/environment.rb
ADDED
data/lib/gemconfig.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SSOReady
|
4
|
+
module Gemconfig
|
5
|
+
VERSION = ""
|
6
|
+
AUTHORS = [""].freeze
|
7
|
+
EMAIL = ""
|
8
|
+
SUMMARY = ""
|
9
|
+
DESCRIPTION = ""
|
10
|
+
HOMEPAGE = "https://github.com/ssoready/ssoready-ruby"
|
11
|
+
SOURCE_CODE_URI = "https://github.com/ssoready/ssoready-ruby"
|
12
|
+
CHANGELOG_URI = "https://github.com/ssoready/ssoready-ruby/blob/master/CHANGELOG.md"
|
13
|
+
end
|
14
|
+
end
|
data/lib/requests.rb
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "environment"
|
4
|
+
require "faraday"
|
5
|
+
require "faraday/retry"
|
6
|
+
require "async/http/faraday"
|
7
|
+
|
8
|
+
module SSOReady
|
9
|
+
class RequestClient
|
10
|
+
# @return [Hash{String => String}]
|
11
|
+
attr_reader :headers
|
12
|
+
# @return [Faraday]
|
13
|
+
attr_reader :conn
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :base_url
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :default_environment
|
18
|
+
|
19
|
+
# @param environment [SSOReady::Environment]
|
20
|
+
# @param base_url [String]
|
21
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
22
|
+
# @param timeout_in_seconds [Long]
|
23
|
+
# @param api_key [String]
|
24
|
+
# @return [SSOReady::RequestClient]
|
25
|
+
def initialize(environment: SSOReady::Environment::DEFAULT, base_url: nil, max_retries: nil,
|
26
|
+
timeout_in_seconds: nil, api_key: nil)
|
27
|
+
@default_environment = environment
|
28
|
+
@base_url = environment || base_url
|
29
|
+
@headers = {
|
30
|
+
"X-Fern-Language": "Ruby",
|
31
|
+
"X-Fern-SDK-Name": "ssoready",
|
32
|
+
"X-Fern-SDK-Version": "0.1.0",
|
33
|
+
"Authorization": %(Bearer #{api_key || ENV["SSOREADY_API_KEY"]})
|
34
|
+
}
|
35
|
+
@conn = Faraday.new(headers: @headers) do |faraday|
|
36
|
+
faraday.request :json
|
37
|
+
faraday.response :raise_error, include_request: true
|
38
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
39
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# @param request_options [SSOReady::RequestOptions]
|
44
|
+
# @return [String]
|
45
|
+
def get_url(request_options: nil)
|
46
|
+
request_options&.base_url || @default_environment || @base_url
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class AsyncRequestClient
|
51
|
+
# @return [Hash{String => String}]
|
52
|
+
attr_reader :headers
|
53
|
+
# @return [Faraday]
|
54
|
+
attr_reader :conn
|
55
|
+
# @return [String]
|
56
|
+
attr_reader :base_url
|
57
|
+
# @return [String]
|
58
|
+
attr_reader :default_environment
|
59
|
+
|
60
|
+
# @param environment [SSOReady::Environment]
|
61
|
+
# @param base_url [String]
|
62
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
63
|
+
# @param timeout_in_seconds [Long]
|
64
|
+
# @param api_key [String]
|
65
|
+
# @return [SSOReady::AsyncRequestClient]
|
66
|
+
def initialize(environment: SSOReady::Environment::DEFAULT, base_url: nil, max_retries: nil,
|
67
|
+
timeout_in_seconds: nil, api_key: nil)
|
68
|
+
@default_environment = environment
|
69
|
+
@base_url = environment || base_url
|
70
|
+
@headers = {
|
71
|
+
"X-Fern-Language": "Ruby",
|
72
|
+
"X-Fern-SDK-Name": "ssoready",
|
73
|
+
"X-Fern-SDK-Version": "0.1.0",
|
74
|
+
"Authorization": %(Bearer #{api_key || ENV["SSOREADY_API_KEY"]})
|
75
|
+
}
|
76
|
+
@conn = Faraday.new(headers: @headers) do |faraday|
|
77
|
+
faraday.request :json
|
78
|
+
faraday.response :raise_error, include_request: true
|
79
|
+
faraday.adapter :async_http
|
80
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
81
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# @param request_options [SSOReady::RequestOptions]
|
86
|
+
# @return [String]
|
87
|
+
def get_url(request_options: nil)
|
88
|
+
request_options&.base_url || @default_environment || @base_url
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Additional options for request-specific configuration when calling APIs via the
|
93
|
+
# SDK.
|
94
|
+
class RequestOptions
|
95
|
+
# @return [String]
|
96
|
+
attr_reader :base_url
|
97
|
+
# @return [String]
|
98
|
+
attr_reader :api_key
|
99
|
+
# @return [Hash{String => Object}]
|
100
|
+
attr_reader :additional_headers
|
101
|
+
# @return [Hash{String => Object}]
|
102
|
+
attr_reader :additional_query_parameters
|
103
|
+
# @return [Hash{String => Object}]
|
104
|
+
attr_reader :additional_body_parameters
|
105
|
+
# @return [Long]
|
106
|
+
attr_reader :timeout_in_seconds
|
107
|
+
|
108
|
+
# @param base_url [String]
|
109
|
+
# @param api_key [String]
|
110
|
+
# @param additional_headers [Hash{String => Object}]
|
111
|
+
# @param additional_query_parameters [Hash{String => Object}]
|
112
|
+
# @param additional_body_parameters [Hash{String => Object}]
|
113
|
+
# @param timeout_in_seconds [Long]
|
114
|
+
# @return [SSOReady::RequestOptions]
|
115
|
+
def initialize(base_url: nil, api_key: nil, additional_headers: nil, additional_query_parameters: nil,
|
116
|
+
additional_body_parameters: nil, timeout_in_seconds: nil)
|
117
|
+
@base_url = base_url
|
118
|
+
@api_key = api_key
|
119
|
+
@additional_headers = additional_headers
|
120
|
+
@additional_query_parameters = additional_query_parameters
|
121
|
+
@additional_body_parameters = additional_body_parameters
|
122
|
+
@timeout_in_seconds = timeout_in_seconds
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Additional options for request-specific configuration when calling APIs via the
|
127
|
+
# SDK.
|
128
|
+
class IdempotencyRequestOptions
|
129
|
+
# @return [String]
|
130
|
+
attr_reader :base_url
|
131
|
+
# @return [String]
|
132
|
+
attr_reader :api_key
|
133
|
+
# @return [Hash{String => Object}]
|
134
|
+
attr_reader :additional_headers
|
135
|
+
# @return [Hash{String => Object}]
|
136
|
+
attr_reader :additional_query_parameters
|
137
|
+
# @return [Hash{String => Object}]
|
138
|
+
attr_reader :additional_body_parameters
|
139
|
+
# @return [Long]
|
140
|
+
attr_reader :timeout_in_seconds
|
141
|
+
|
142
|
+
# @param base_url [String]
|
143
|
+
# @param api_key [String]
|
144
|
+
# @param additional_headers [Hash{String => Object}]
|
145
|
+
# @param additional_query_parameters [Hash{String => Object}]
|
146
|
+
# @param additional_body_parameters [Hash{String => Object}]
|
147
|
+
# @param timeout_in_seconds [Long]
|
148
|
+
# @return [SSOReady::IdempotencyRequestOptions]
|
149
|
+
def initialize(base_url: nil, api_key: nil, additional_headers: nil, additional_query_parameters: nil,
|
150
|
+
additional_body_parameters: nil, timeout_in_seconds: nil)
|
151
|
+
@base_url = base_url
|
152
|
+
@api_key = api_key
|
153
|
+
@additional_headers = additional_headers
|
154
|
+
@additional_query_parameters = additional_query_parameters
|
155
|
+
@additional_body_parameters = additional_body_parameters
|
156
|
+
@timeout_in_seconds = timeout_in_seconds
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "organizations/client"
|
5
|
+
require_relative "saml_connections/client"
|
6
|
+
require_relative "scim_directories/client"
|
7
|
+
require_relative "setup_urls/client"
|
8
|
+
|
9
|
+
module SSOReady
|
10
|
+
module Management
|
11
|
+
class Client
|
12
|
+
# @return [SSOReady::Management::OrganizationsClient]
|
13
|
+
attr_reader :organizations
|
14
|
+
# @return [SSOReady::Management::SAMLConnectionsClient]
|
15
|
+
attr_reader :saml_connections
|
16
|
+
# @return [SSOReady::Management::SCIMDirectoriesClient]
|
17
|
+
attr_reader :scim_directories
|
18
|
+
# @return [SSOReady::Management::SetupURLsClient]
|
19
|
+
attr_reader :setup_urls
|
20
|
+
|
21
|
+
# @param request_client [SSOReady::RequestClient]
|
22
|
+
# @return [SSOReady::Management::Client]
|
23
|
+
def initialize(request_client:)
|
24
|
+
@organizations = SSOReady::Management::OrganizationsClient.new(request_client: request_client)
|
25
|
+
@saml_connections = SSOReady::Management::SAMLConnectionsClient.new(request_client: request_client)
|
26
|
+
@scim_directories = SSOReady::Management::SCIMDirectoriesClient.new(request_client: request_client)
|
27
|
+
@setup_urls = SSOReady::Management::SetupURLsClient.new(request_client: request_client)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class AsyncClient
|
32
|
+
# @return [SSOReady::Management::AsyncOrganizationsClient]
|
33
|
+
attr_reader :organizations
|
34
|
+
# @return [SSOReady::Management::AsyncSAMLConnectionsClient]
|
35
|
+
attr_reader :saml_connections
|
36
|
+
# @return [SSOReady::Management::AsyncSCIMDirectoriesClient]
|
37
|
+
attr_reader :scim_directories
|
38
|
+
# @return [SSOReady::Management::AsyncSetupURLsClient]
|
39
|
+
attr_reader :setup_urls
|
40
|
+
|
41
|
+
# @param request_client [SSOReady::AsyncRequestClient]
|
42
|
+
# @return [SSOReady::Management::AsyncClient]
|
43
|
+
def initialize(request_client:)
|
44
|
+
@organizations = SSOReady::Management::AsyncOrganizationsClient.new(request_client: request_client)
|
45
|
+
@saml_connections = SSOReady::Management::AsyncSAMLConnectionsClient.new(request_client: request_client)
|
46
|
+
@scim_directories = SSOReady::Management::AsyncSCIMDirectoriesClient.new(request_client: request_client)
|
47
|
+
@setup_urls = SSOReady::Management::AsyncSetupURLsClient.new(request_client: request_client)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../requests"
|
4
|
+
require_relative "../../types/list_organizations_response"
|
5
|
+
require_relative "../../types/organization"
|
6
|
+
require_relative "../../types/create_organization_response"
|
7
|
+
require_relative "../../types/get_organization_response"
|
8
|
+
require_relative "../../types/update_organization_response"
|
9
|
+
require "async"
|
10
|
+
|
11
|
+
module SSOReady
|
12
|
+
module Management
|
13
|
+
class OrganizationsClient
|
14
|
+
# @return [SSOReady::RequestClient]
|
15
|
+
attr_reader :request_client
|
16
|
+
|
17
|
+
# @param request_client [SSOReady::RequestClient]
|
18
|
+
# @return [SSOReady::Management::OrganizationsClient]
|
19
|
+
def initialize(request_client:)
|
20
|
+
@request_client = request_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# Gets a list of organizations.
|
24
|
+
#
|
25
|
+
# @param page_token [String] Pagination token. Leave empty to get the first page of results.
|
26
|
+
# @param request_options [SSOReady::RequestOptions]
|
27
|
+
# @return [SSOReady::ListOrganizationsResponse]
|
28
|
+
# @example
|
29
|
+
# api = SSOReady::Client.new(
|
30
|
+
# environment: SSOReady::Environment::DEFAULT,
|
31
|
+
# base_url: "https://api.example.com",
|
32
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
33
|
+
# )
|
34
|
+
# api.management.organizations.list_organizations
|
35
|
+
def list_organizations(page_token: nil, request_options: nil)
|
36
|
+
response = @request_client.conn.get do |req|
|
37
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
38
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
39
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
40
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "pageToken": page_token }.compact
|
41
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations"
|
42
|
+
end
|
43
|
+
SSOReady::ListOrganizationsResponse.from_json(json_object: response.body)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Creates an organization.
|
47
|
+
#
|
48
|
+
# @param request [Hash] Request of type SSOReady::Organization, as a Hash
|
49
|
+
# * :id (String)
|
50
|
+
# * :environment_id (String)
|
51
|
+
# * :display_name (String)
|
52
|
+
# * :external_id (String)
|
53
|
+
# * :domains (Array<String>)
|
54
|
+
# @param request_options [SSOReady::RequestOptions]
|
55
|
+
# @return [SSOReady::CreateOrganizationResponse]
|
56
|
+
# @example
|
57
|
+
# api = SSOReady::Client.new(
|
58
|
+
# environment: SSOReady::Environment::DEFAULT,
|
59
|
+
# base_url: "https://api.example.com",
|
60
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
61
|
+
# )
|
62
|
+
# api.management.organizations.create_organization(request: { })
|
63
|
+
def create_organization(request:, request_options: nil)
|
64
|
+
response = @request_client.conn.post do |req|
|
65
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
66
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
67
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
68
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
69
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations"
|
70
|
+
end
|
71
|
+
SSOReady::CreateOrganizationResponse.from_json(json_object: response.body)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Gets an organization.
|
75
|
+
#
|
76
|
+
# @param id [String] ID of the organization to get.
|
77
|
+
# @param request_options [SSOReady::RequestOptions]
|
78
|
+
# @return [SSOReady::GetOrganizationResponse]
|
79
|
+
# @example
|
80
|
+
# api = SSOReady::Client.new(
|
81
|
+
# environment: SSOReady::Environment::DEFAULT,
|
82
|
+
# base_url: "https://api.example.com",
|
83
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
84
|
+
# )
|
85
|
+
# api.management.organizations.get_organization(id: "id")
|
86
|
+
def get_organization(id:, request_options: nil)
|
87
|
+
response = @request_client.conn.get do |req|
|
88
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
89
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
90
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
91
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations/#{id}"
|
92
|
+
end
|
93
|
+
SSOReady::GetOrganizationResponse.from_json(json_object: response.body)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Updates an organization.
|
97
|
+
#
|
98
|
+
# @param id [String] ID of the organization to update.
|
99
|
+
# @param request [Hash] Request of type SSOReady::Organization, as a Hash
|
100
|
+
# * :id (String)
|
101
|
+
# * :environment_id (String)
|
102
|
+
# * :display_name (String)
|
103
|
+
# * :external_id (String)
|
104
|
+
# * :domains (Array<String>)
|
105
|
+
# @param request_options [SSOReady::RequestOptions]
|
106
|
+
# @return [SSOReady::UpdateOrganizationResponse]
|
107
|
+
# @example
|
108
|
+
# api = SSOReady::Client.new(
|
109
|
+
# environment: SSOReady::Environment::DEFAULT,
|
110
|
+
# base_url: "https://api.example.com",
|
111
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
112
|
+
# )
|
113
|
+
# api.management.organizations.update_organization(id: "id", request: { })
|
114
|
+
def update_organization(id:, request:, request_options: nil)
|
115
|
+
response = @request_client.conn.patch do |req|
|
116
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
117
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
118
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
119
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
120
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations/#{id}"
|
121
|
+
end
|
122
|
+
SSOReady::UpdateOrganizationResponse.from_json(json_object: response.body)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class AsyncOrganizationsClient
|
127
|
+
# @return [SSOReady::AsyncRequestClient]
|
128
|
+
attr_reader :request_client
|
129
|
+
|
130
|
+
# @param request_client [SSOReady::AsyncRequestClient]
|
131
|
+
# @return [SSOReady::Management::AsyncOrganizationsClient]
|
132
|
+
def initialize(request_client:)
|
133
|
+
@request_client = request_client
|
134
|
+
end
|
135
|
+
|
136
|
+
# Gets a list of organizations.
|
137
|
+
#
|
138
|
+
# @param page_token [String] Pagination token. Leave empty to get the first page of results.
|
139
|
+
# @param request_options [SSOReady::RequestOptions]
|
140
|
+
# @return [SSOReady::ListOrganizationsResponse]
|
141
|
+
# @example
|
142
|
+
# api = SSOReady::Client.new(
|
143
|
+
# environment: SSOReady::Environment::DEFAULT,
|
144
|
+
# base_url: "https://api.example.com",
|
145
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
146
|
+
# )
|
147
|
+
# api.management.organizations.list_organizations
|
148
|
+
def list_organizations(page_token: nil, request_options: nil)
|
149
|
+
Async do
|
150
|
+
response = @request_client.conn.get do |req|
|
151
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
152
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
153
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
154
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "pageToken": page_token }.compact
|
155
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations"
|
156
|
+
end
|
157
|
+
SSOReady::ListOrganizationsResponse.from_json(json_object: response.body)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Creates an organization.
|
162
|
+
#
|
163
|
+
# @param request [Hash] Request of type SSOReady::Organization, as a Hash
|
164
|
+
# * :id (String)
|
165
|
+
# * :environment_id (String)
|
166
|
+
# * :display_name (String)
|
167
|
+
# * :external_id (String)
|
168
|
+
# * :domains (Array<String>)
|
169
|
+
# @param request_options [SSOReady::RequestOptions]
|
170
|
+
# @return [SSOReady::CreateOrganizationResponse]
|
171
|
+
# @example
|
172
|
+
# api = SSOReady::Client.new(
|
173
|
+
# environment: SSOReady::Environment::DEFAULT,
|
174
|
+
# base_url: "https://api.example.com",
|
175
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
176
|
+
# )
|
177
|
+
# api.management.organizations.create_organization(request: { })
|
178
|
+
def create_organization(request:, request_options: nil)
|
179
|
+
Async do
|
180
|
+
response = @request_client.conn.post do |req|
|
181
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
182
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
183
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
184
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
185
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations"
|
186
|
+
end
|
187
|
+
SSOReady::CreateOrganizationResponse.from_json(json_object: response.body)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Gets an organization.
|
192
|
+
#
|
193
|
+
# @param id [String] ID of the organization to get.
|
194
|
+
# @param request_options [SSOReady::RequestOptions]
|
195
|
+
# @return [SSOReady::GetOrganizationResponse]
|
196
|
+
# @example
|
197
|
+
# api = SSOReady::Client.new(
|
198
|
+
# environment: SSOReady::Environment::DEFAULT,
|
199
|
+
# base_url: "https://api.example.com",
|
200
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
201
|
+
# )
|
202
|
+
# api.management.organizations.get_organization(id: "id")
|
203
|
+
def get_organization(id:, request_options: nil)
|
204
|
+
Async do
|
205
|
+
response = @request_client.conn.get do |req|
|
206
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
207
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
208
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
209
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations/#{id}"
|
210
|
+
end
|
211
|
+
SSOReady::GetOrganizationResponse.from_json(json_object: response.body)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Updates an organization.
|
216
|
+
#
|
217
|
+
# @param id [String] ID of the organization to update.
|
218
|
+
# @param request [Hash] Request of type SSOReady::Organization, as a Hash
|
219
|
+
# * :id (String)
|
220
|
+
# * :environment_id (String)
|
221
|
+
# * :display_name (String)
|
222
|
+
# * :external_id (String)
|
223
|
+
# * :domains (Array<String>)
|
224
|
+
# @param request_options [SSOReady::RequestOptions]
|
225
|
+
# @return [SSOReady::UpdateOrganizationResponse]
|
226
|
+
# @example
|
227
|
+
# api = SSOReady::Client.new(
|
228
|
+
# environment: SSOReady::Environment::DEFAULT,
|
229
|
+
# base_url: "https://api.example.com",
|
230
|
+
# api_key: "YOUR_AUTH_TOKEN"
|
231
|
+
# )
|
232
|
+
# api.management.organizations.update_organization(id: "id", request: { })
|
233
|
+
def update_organization(id:, request:, request_options: nil)
|
234
|
+
Async do
|
235
|
+
response = @request_client.conn.patch do |req|
|
236
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
237
|
+
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
238
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
239
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
240
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/v1/organizations/#{id}"
|
241
|
+
end
|
242
|
+
SSOReady::UpdateOrganizationResponse.from_json(json_object: response.body)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|