ssoready 0.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.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/lib/environment.rb +7 -0
  3. data/lib/gemconfig.rb +14 -0
  4. data/lib/requests.rb +159 -0
  5. data/lib/ssoready/management/client.rb +51 -0
  6. data/lib/ssoready/management/organizations/client.rb +247 -0
  7. data/lib/ssoready/management/saml_connections/client.rb +269 -0
  8. data/lib/ssoready/management/scim_directories/client.rb +330 -0
  9. data/lib/ssoready/management/setup_urls/client.rb +97 -0
  10. data/lib/ssoready/saml/client.rb +170 -0
  11. data/lib/ssoready/scim/client.rb +296 -0
  12. data/lib/ssoready/types/create_organization_response.rb +63 -0
  13. data/lib/ssoready/types/create_saml_connection_response.rb +63 -0
  14. data/lib/ssoready/types/create_scim_directory_response.rb +63 -0
  15. data/lib/ssoready/types/create_setup_url_response.rb +62 -0
  16. data/lib/ssoready/types/get_organization_response.rb +63 -0
  17. data/lib/ssoready/types/get_saml_connection_response.rb +63 -0
  18. data/lib/ssoready/types/get_saml_redirect_url_response.rb +56 -0
  19. data/lib/ssoready/types/get_scim_directory_response.rb +63 -0
  20. data/lib/ssoready/types/get_scim_group_response.rb +63 -0
  21. data/lib/ssoready/types/get_scim_user_response.rb +63 -0
  22. data/lib/ssoready/types/google_protobuf_any.rb +58 -0
  23. data/lib/ssoready/types/list_organizations_response.rb +73 -0
  24. data/lib/ssoready/types/list_saml_connections_response.rb +73 -0
  25. data/lib/ssoready/types/list_scim_directories_response.rb +73 -0
  26. data/lib/ssoready/types/list_scim_groups_response.rb +73 -0
  27. data/lib/ssoready/types/list_scim_users_response.rb +73 -0
  28. data/lib/ssoready/types/organization.rb +112 -0
  29. data/lib/ssoready/types/redeem_saml_access_code_response.rb +126 -0
  30. data/lib/ssoready/types/rotate_scim_directory_bearer_token_response.rb +63 -0
  31. data/lib/ssoready/types/saml_connection.rb +144 -0
  32. data/lib/ssoready/types/scim_directory.rb +104 -0
  33. data/lib/ssoready/types/scim_group.rb +114 -0
  34. data/lib/ssoready/types/scim_user.rb +102 -0
  35. data/lib/ssoready/types/status.rb +94 -0
  36. data/lib/ssoready/types/update_organization_response.rb +63 -0
  37. data/lib/ssoready/types/update_saml_connection_response.rb +63 -0
  38. data/lib/ssoready/types/update_scim_directory_response.rb +63 -0
  39. data/lib/ssoready.rb +68 -0
  40. data/lib/types_export.rb +29 -0
  41. metadata +163 -0
@@ -0,0 +1,269 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "../../types/list_saml_connections_response"
5
+ require_relative "../../types/saml_connection"
6
+ require_relative "../../types/create_saml_connection_response"
7
+ require_relative "../../types/get_saml_connection_response"
8
+ require_relative "../../types/update_saml_connection_response"
9
+ require "async"
10
+
11
+ module SSOReady
12
+ module Management
13
+ class SAMLConnectionsClient
14
+ # @return [SSOReady::RequestClient]
15
+ attr_reader :request_client
16
+
17
+ # @param request_client [SSOReady::RequestClient]
18
+ # @return [SSOReady::Management::SAMLConnectionsClient]
19
+ def initialize(request_client:)
20
+ @request_client = request_client
21
+ end
22
+
23
+ # Lists SAML connections in an organization.
24
+ #
25
+ # @param organization_id [String] The organization the SAML connections belong to.
26
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
27
+ # @param request_options [SSOReady::RequestOptions]
28
+ # @return [SSOReady::ListSAMLConnectionsResponse]
29
+ # @example
30
+ # api = SSOReady::Client.new(
31
+ # environment: SSOReady::Environment::DEFAULT,
32
+ # base_url: "https://api.example.com",
33
+ # api_key: "YOUR_AUTH_TOKEN"
34
+ # )
35
+ # api.management.saml_connections.list_saml_connections
36
+ def list_saml_connections(organization_id: nil, page_token: nil, request_options: nil)
37
+ response = @request_client.conn.get do |req|
38
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
39
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
40
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
41
+ req.params = {
42
+ **(request_options&.additional_query_parameters || {}),
43
+ "organizationId": organization_id,
44
+ "pageToken": page_token
45
+ }.compact
46
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections"
47
+ end
48
+ SSOReady::ListSAMLConnectionsResponse.from_json(json_object: response.body)
49
+ end
50
+
51
+ # Creates a SAML connection.
52
+ #
53
+ # @param request [Hash] Request of type SSOReady::SAMLConnection, as a Hash
54
+ # * :id (String)
55
+ # * :organization_id (String)
56
+ # * :primary (Boolean)
57
+ # * :idp_redirect_url (String)
58
+ # * :idp_certificate (String)
59
+ # * :idp_entity_id (String)
60
+ # * :sp_entity_id (String)
61
+ # * :sp_acs_url (String)
62
+ # @param request_options [SSOReady::RequestOptions]
63
+ # @return [SSOReady::CreateSAMLConnectionResponse]
64
+ # @example
65
+ # api = SSOReady::Client.new(
66
+ # environment: SSOReady::Environment::DEFAULT,
67
+ # base_url: "https://api.example.com",
68
+ # api_key: "YOUR_AUTH_TOKEN"
69
+ # )
70
+ # api.management.saml_connections.create_saml_connection(request: { })
71
+ def create_saml_connection(request:, request_options: nil)
72
+ response = @request_client.conn.post do |req|
73
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
74
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
75
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
76
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
77
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections"
78
+ end
79
+ SSOReady::CreateSAMLConnectionResponse.from_json(json_object: response.body)
80
+ end
81
+
82
+ # Gets a SAML connection.
83
+ #
84
+ # @param id [String] ID of the SAML connection to get.
85
+ # @param request_options [SSOReady::RequestOptions]
86
+ # @return [SSOReady::GetSAMLConnectionResponse]
87
+ # @example
88
+ # api = SSOReady::Client.new(
89
+ # environment: SSOReady::Environment::DEFAULT,
90
+ # base_url: "https://api.example.com",
91
+ # api_key: "YOUR_AUTH_TOKEN"
92
+ # )
93
+ # api.management.saml_connections.get_saml_connection(id: "id")
94
+ def get_saml_connection(id:, request_options: nil)
95
+ response = @request_client.conn.get do |req|
96
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
97
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
98
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
99
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections/#{id}"
100
+ end
101
+ SSOReady::GetSAMLConnectionResponse.from_json(json_object: response.body)
102
+ end
103
+
104
+ # Updates a SAML connection.
105
+ #
106
+ # @param id [String] The ID of the SAML connection to update.
107
+ # @param request [Hash] Request of type SSOReady::SAMLConnection, as a Hash
108
+ # * :id (String)
109
+ # * :organization_id (String)
110
+ # * :primary (Boolean)
111
+ # * :idp_redirect_url (String)
112
+ # * :idp_certificate (String)
113
+ # * :idp_entity_id (String)
114
+ # * :sp_entity_id (String)
115
+ # * :sp_acs_url (String)
116
+ # @param request_options [SSOReady::RequestOptions]
117
+ # @return [SSOReady::UpdateSAMLConnectionResponse]
118
+ # @example
119
+ # api = SSOReady::Client.new(
120
+ # environment: SSOReady::Environment::DEFAULT,
121
+ # base_url: "https://api.example.com",
122
+ # api_key: "YOUR_AUTH_TOKEN"
123
+ # )
124
+ # api.management.saml_connections.update_saml_connection(id: "id", request: { })
125
+ def update_saml_connection(id:, request:, request_options: nil)
126
+ response = @request_client.conn.patch do |req|
127
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
128
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
129
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
130
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
131
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections/#{id}"
132
+ end
133
+ SSOReady::UpdateSAMLConnectionResponse.from_json(json_object: response.body)
134
+ end
135
+ end
136
+
137
+ class AsyncSAMLConnectionsClient
138
+ # @return [SSOReady::AsyncRequestClient]
139
+ attr_reader :request_client
140
+
141
+ # @param request_client [SSOReady::AsyncRequestClient]
142
+ # @return [SSOReady::Management::AsyncSAMLConnectionsClient]
143
+ def initialize(request_client:)
144
+ @request_client = request_client
145
+ end
146
+
147
+ # Lists SAML connections in an organization.
148
+ #
149
+ # @param organization_id [String] The organization the SAML connections belong to.
150
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
151
+ # @param request_options [SSOReady::RequestOptions]
152
+ # @return [SSOReady::ListSAMLConnectionsResponse]
153
+ # @example
154
+ # api = SSOReady::Client.new(
155
+ # environment: SSOReady::Environment::DEFAULT,
156
+ # base_url: "https://api.example.com",
157
+ # api_key: "YOUR_AUTH_TOKEN"
158
+ # )
159
+ # api.management.saml_connections.list_saml_connections
160
+ def list_saml_connections(organization_id: nil, page_token: nil, request_options: nil)
161
+ Async do
162
+ response = @request_client.conn.get do |req|
163
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
164
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
165
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
166
+ req.params = {
167
+ **(request_options&.additional_query_parameters || {}),
168
+ "organizationId": organization_id,
169
+ "pageToken": page_token
170
+ }.compact
171
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections"
172
+ end
173
+ SSOReady::ListSAMLConnectionsResponse.from_json(json_object: response.body)
174
+ end
175
+ end
176
+
177
+ # Creates a SAML connection.
178
+ #
179
+ # @param request [Hash] Request of type SSOReady::SAMLConnection, as a Hash
180
+ # * :id (String)
181
+ # * :organization_id (String)
182
+ # * :primary (Boolean)
183
+ # * :idp_redirect_url (String)
184
+ # * :idp_certificate (String)
185
+ # * :idp_entity_id (String)
186
+ # * :sp_entity_id (String)
187
+ # * :sp_acs_url (String)
188
+ # @param request_options [SSOReady::RequestOptions]
189
+ # @return [SSOReady::CreateSAMLConnectionResponse]
190
+ # @example
191
+ # api = SSOReady::Client.new(
192
+ # environment: SSOReady::Environment::DEFAULT,
193
+ # base_url: "https://api.example.com",
194
+ # api_key: "YOUR_AUTH_TOKEN"
195
+ # )
196
+ # api.management.saml_connections.create_saml_connection(request: { })
197
+ def create_saml_connection(request:, request_options: nil)
198
+ Async do
199
+ response = @request_client.conn.post do |req|
200
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
201
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
202
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
203
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
204
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections"
205
+ end
206
+ SSOReady::CreateSAMLConnectionResponse.from_json(json_object: response.body)
207
+ end
208
+ end
209
+
210
+ # Gets a SAML connection.
211
+ #
212
+ # @param id [String] ID of the SAML connection to get.
213
+ # @param request_options [SSOReady::RequestOptions]
214
+ # @return [SSOReady::GetSAMLConnectionResponse]
215
+ # @example
216
+ # api = SSOReady::Client.new(
217
+ # environment: SSOReady::Environment::DEFAULT,
218
+ # base_url: "https://api.example.com",
219
+ # api_key: "YOUR_AUTH_TOKEN"
220
+ # )
221
+ # api.management.saml_connections.get_saml_connection(id: "id")
222
+ def get_saml_connection(id:, request_options: nil)
223
+ Async do
224
+ response = @request_client.conn.get do |req|
225
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
226
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
227
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
228
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections/#{id}"
229
+ end
230
+ SSOReady::GetSAMLConnectionResponse.from_json(json_object: response.body)
231
+ end
232
+ end
233
+
234
+ # Updates a SAML connection.
235
+ #
236
+ # @param id [String] The ID of the SAML connection to update.
237
+ # @param request [Hash] Request of type SSOReady::SAMLConnection, as a Hash
238
+ # * :id (String)
239
+ # * :organization_id (String)
240
+ # * :primary (Boolean)
241
+ # * :idp_redirect_url (String)
242
+ # * :idp_certificate (String)
243
+ # * :idp_entity_id (String)
244
+ # * :sp_entity_id (String)
245
+ # * :sp_acs_url (String)
246
+ # @param request_options [SSOReady::RequestOptions]
247
+ # @return [SSOReady::UpdateSAMLConnectionResponse]
248
+ # @example
249
+ # api = SSOReady::Client.new(
250
+ # environment: SSOReady::Environment::DEFAULT,
251
+ # base_url: "https://api.example.com",
252
+ # api_key: "YOUR_AUTH_TOKEN"
253
+ # )
254
+ # api.management.saml_connections.update_saml_connection(id: "id", request: { })
255
+ def update_saml_connection(id:, request:, request_options: nil)
256
+ Async do
257
+ response = @request_client.conn.patch do |req|
258
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
259
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
260
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
261
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
262
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml-connections/#{id}"
263
+ end
264
+ SSOReady::UpdateSAMLConnectionResponse.from_json(json_object: response.body)
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
@@ -0,0 +1,330 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "../../types/list_scim_directories_response"
5
+ require_relative "../../types/scim_directory"
6
+ require_relative "../../types/create_scim_directory_response"
7
+ require_relative "../../types/get_scim_directory_response"
8
+ require_relative "../../types/update_scim_directory_response"
9
+ require_relative "../../types/rotate_scim_directory_bearer_token_response"
10
+ require "async"
11
+
12
+ module SSOReady
13
+ module Management
14
+ class SCIMDirectoriesClient
15
+ # @return [SSOReady::RequestClient]
16
+ attr_reader :request_client
17
+
18
+ # @param request_client [SSOReady::RequestClient]
19
+ # @return [SSOReady::Management::SCIMDirectoriesClient]
20
+ def initialize(request_client:)
21
+ @request_client = request_client
22
+ end
23
+
24
+ # Gets a list of SCIM directories in an organization.
25
+ #
26
+ # @param organization_id [String] The organization the SCIM directories belong to.
27
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
28
+ # @param request_options [SSOReady::RequestOptions]
29
+ # @return [SSOReady::ListSCIMDirectoriesResponse]
30
+ # @example
31
+ # api = SSOReady::Client.new(
32
+ # environment: SSOReady::Environment::DEFAULT,
33
+ # base_url: "https://api.example.com",
34
+ # api_key: "YOUR_AUTH_TOKEN"
35
+ # )
36
+ # api.management.scim_directories.list_scim_directories
37
+ def list_scim_directories(organization_id: nil, page_token: nil, request_options: nil)
38
+ response = @request_client.conn.get do |req|
39
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
40
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
41
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
42
+ req.params = {
43
+ **(request_options&.additional_query_parameters || {}),
44
+ "organizationId": organization_id,
45
+ "pageToken": page_token
46
+ }.compact
47
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories"
48
+ end
49
+ SSOReady::ListSCIMDirectoriesResponse.from_json(json_object: response.body)
50
+ end
51
+
52
+ # Creates a SCIM directory.
53
+ #
54
+ # @param request [Hash] Request of type SSOReady::SCIMDirectory, as a Hash
55
+ # * :id (String)
56
+ # * :organization_id (String)
57
+ # * :primary (Boolean)
58
+ # * :scim_base_url (String)
59
+ # * :has_client_bearer_token (Boolean)
60
+ # @param request_options [SSOReady::RequestOptions]
61
+ # @return [SSOReady::CreateSCIMDirectoryResponse]
62
+ # @example
63
+ # api = SSOReady::Client.new(
64
+ # environment: SSOReady::Environment::DEFAULT,
65
+ # base_url: "https://api.example.com",
66
+ # api_key: "YOUR_AUTH_TOKEN"
67
+ # )
68
+ # api.management.scim_directories.create_scim_directory(request: { })
69
+ def create_scim_directory(request:, request_options: nil)
70
+ response = @request_client.conn.post do |req|
71
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
72
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
73
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
74
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
75
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories"
76
+ end
77
+ SSOReady::CreateSCIMDirectoryResponse.from_json(json_object: response.body)
78
+ end
79
+
80
+ # Gets a SCIM directory.
81
+ #
82
+ # @param id [String] The ID of the SCIM directory.
83
+ # @param request_options [SSOReady::RequestOptions]
84
+ # @return [SSOReady::GetSCIMDirectoryResponse]
85
+ # @example
86
+ # api = SSOReady::Client.new(
87
+ # environment: SSOReady::Environment::DEFAULT,
88
+ # base_url: "https://api.example.com",
89
+ # api_key: "YOUR_AUTH_TOKEN"
90
+ # )
91
+ # api.management.scim_directories.get_scim_directory(id: "id")
92
+ def get_scim_directory(id:, request_options: nil)
93
+ response = @request_client.conn.get do |req|
94
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
95
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
96
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
97
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories/#{id}"
98
+ end
99
+ SSOReady::GetSCIMDirectoryResponse.from_json(json_object: response.body)
100
+ end
101
+
102
+ # Updates a SCIM directory.
103
+ #
104
+ # @param id [String] The ID of the SCIM directory to update.
105
+ # @param request [Hash] Request of type SSOReady::SCIMDirectory, as a Hash
106
+ # * :id (String)
107
+ # * :organization_id (String)
108
+ # * :primary (Boolean)
109
+ # * :scim_base_url (String)
110
+ # * :has_client_bearer_token (Boolean)
111
+ # @param request_options [SSOReady::RequestOptions]
112
+ # @return [SSOReady::UpdateSCIMDirectoryResponse]
113
+ # @example
114
+ # api = SSOReady::Client.new(
115
+ # environment: SSOReady::Environment::DEFAULT,
116
+ # base_url: "https://api.example.com",
117
+ # api_key: "YOUR_AUTH_TOKEN"
118
+ # )
119
+ # api.management.scim_directories.update_scim_directory(id: "id", request: { })
120
+ def update_scim_directory(id:, request:, request_options: nil)
121
+ response = @request_client.conn.patch do |req|
122
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
123
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
124
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
125
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
126
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories/#{id}"
127
+ end
128
+ SSOReady::UpdateSCIMDirectoryResponse.from_json(json_object: response.body)
129
+ end
130
+
131
+ # Rotates a SCIM directory's bearer token.
132
+ # Every SCIM directory has a bearer token that SSOReady uses to authenticate
133
+ # requests sent from your customer's
134
+ # Identity Provider. These bearer tokens are assigned by SSOReady, and are secret.
135
+ # Newly-created SCIM directories do
136
+ # not have any bearer token at all; you must use this endpoint to get an initial
137
+ # value.
138
+ # Rotating a SCIM directory bearer token immediately invalidates the previous
139
+ # bearer token, if any. Your customer
140
+ # will need to update their SCIM configuration with the new value to make SCIM
141
+ # syncing work again.
142
+ # SSOReady only stores the hash of these bearer tokens. If your customer has lost
143
+ # their copy, you must use this
144
+ # endpoint to generate a new one.
145
+ #
146
+ # @param id [String] The ID of the SCIM directory whose bearer token to rotate.
147
+ # @param request_options [SSOReady::RequestOptions]
148
+ # @return [SSOReady::RotateSCIMDirectoryBearerTokenResponse]
149
+ # @example
150
+ # api = SSOReady::Client.new(
151
+ # environment: SSOReady::Environment::DEFAULT,
152
+ # base_url: "https://api.example.com",
153
+ # api_key: "YOUR_AUTH_TOKEN"
154
+ # )
155
+ # api.management.scim_directories.rotate_scim_directory_bearer_token(id: "id")
156
+ def rotate_scim_directory_bearer_token(id:, request_options: nil)
157
+ response = @request_client.conn.post do |req|
158
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
159
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
160
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
161
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories/#{id}/rotate-bearer-token"
162
+ end
163
+ SSOReady::RotateSCIMDirectoryBearerTokenResponse.from_json(json_object: response.body)
164
+ end
165
+ end
166
+
167
+ class AsyncSCIMDirectoriesClient
168
+ # @return [SSOReady::AsyncRequestClient]
169
+ attr_reader :request_client
170
+
171
+ # @param request_client [SSOReady::AsyncRequestClient]
172
+ # @return [SSOReady::Management::AsyncSCIMDirectoriesClient]
173
+ def initialize(request_client:)
174
+ @request_client = request_client
175
+ end
176
+
177
+ # Gets a list of SCIM directories in an organization.
178
+ #
179
+ # @param organization_id [String] The organization the SCIM directories belong to.
180
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
181
+ # @param request_options [SSOReady::RequestOptions]
182
+ # @return [SSOReady::ListSCIMDirectoriesResponse]
183
+ # @example
184
+ # api = SSOReady::Client.new(
185
+ # environment: SSOReady::Environment::DEFAULT,
186
+ # base_url: "https://api.example.com",
187
+ # api_key: "YOUR_AUTH_TOKEN"
188
+ # )
189
+ # api.management.scim_directories.list_scim_directories
190
+ def list_scim_directories(organization_id: nil, page_token: nil, request_options: nil)
191
+ Async do
192
+ response = @request_client.conn.get do |req|
193
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
194
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
195
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
196
+ req.params = {
197
+ **(request_options&.additional_query_parameters || {}),
198
+ "organizationId": organization_id,
199
+ "pageToken": page_token
200
+ }.compact
201
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories"
202
+ end
203
+ SSOReady::ListSCIMDirectoriesResponse.from_json(json_object: response.body)
204
+ end
205
+ end
206
+
207
+ # Creates a SCIM directory.
208
+ #
209
+ # @param request [Hash] Request of type SSOReady::SCIMDirectory, as a Hash
210
+ # * :id (String)
211
+ # * :organization_id (String)
212
+ # * :primary (Boolean)
213
+ # * :scim_base_url (String)
214
+ # * :has_client_bearer_token (Boolean)
215
+ # @param request_options [SSOReady::RequestOptions]
216
+ # @return [SSOReady::CreateSCIMDirectoryResponse]
217
+ # @example
218
+ # api = SSOReady::Client.new(
219
+ # environment: SSOReady::Environment::DEFAULT,
220
+ # base_url: "https://api.example.com",
221
+ # api_key: "YOUR_AUTH_TOKEN"
222
+ # )
223
+ # api.management.scim_directories.create_scim_directory(request: { })
224
+ def create_scim_directory(request:, request_options: nil)
225
+ Async do
226
+ response = @request_client.conn.post do |req|
227
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
228
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
229
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
230
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
231
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories"
232
+ end
233
+ SSOReady::CreateSCIMDirectoryResponse.from_json(json_object: response.body)
234
+ end
235
+ end
236
+
237
+ # Gets a SCIM directory.
238
+ #
239
+ # @param id [String] The ID of the SCIM directory.
240
+ # @param request_options [SSOReady::RequestOptions]
241
+ # @return [SSOReady::GetSCIMDirectoryResponse]
242
+ # @example
243
+ # api = SSOReady::Client.new(
244
+ # environment: SSOReady::Environment::DEFAULT,
245
+ # base_url: "https://api.example.com",
246
+ # api_key: "YOUR_AUTH_TOKEN"
247
+ # )
248
+ # api.management.scim_directories.get_scim_directory(id: "id")
249
+ def get_scim_directory(id:, request_options: nil)
250
+ Async do
251
+ response = @request_client.conn.get do |req|
252
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
253
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
254
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
255
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories/#{id}"
256
+ end
257
+ SSOReady::GetSCIMDirectoryResponse.from_json(json_object: response.body)
258
+ end
259
+ end
260
+
261
+ # Updates a SCIM directory.
262
+ #
263
+ # @param id [String] The ID of the SCIM directory to update.
264
+ # @param request [Hash] Request of type SSOReady::SCIMDirectory, as a Hash
265
+ # * :id (String)
266
+ # * :organization_id (String)
267
+ # * :primary (Boolean)
268
+ # * :scim_base_url (String)
269
+ # * :has_client_bearer_token (Boolean)
270
+ # @param request_options [SSOReady::RequestOptions]
271
+ # @return [SSOReady::UpdateSCIMDirectoryResponse]
272
+ # @example
273
+ # api = SSOReady::Client.new(
274
+ # environment: SSOReady::Environment::DEFAULT,
275
+ # base_url: "https://api.example.com",
276
+ # api_key: "YOUR_AUTH_TOKEN"
277
+ # )
278
+ # api.management.scim_directories.update_scim_directory(id: "id", request: { })
279
+ def update_scim_directory(id:, request:, request_options: nil)
280
+ Async do
281
+ response = @request_client.conn.patch do |req|
282
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
283
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
284
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
285
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
286
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories/#{id}"
287
+ end
288
+ SSOReady::UpdateSCIMDirectoryResponse.from_json(json_object: response.body)
289
+ end
290
+ end
291
+
292
+ # Rotates a SCIM directory's bearer token.
293
+ # Every SCIM directory has a bearer token that SSOReady uses to authenticate
294
+ # requests sent from your customer's
295
+ # Identity Provider. These bearer tokens are assigned by SSOReady, and are secret.
296
+ # Newly-created SCIM directories do
297
+ # not have any bearer token at all; you must use this endpoint to get an initial
298
+ # value.
299
+ # Rotating a SCIM directory bearer token immediately invalidates the previous
300
+ # bearer token, if any. Your customer
301
+ # will need to update their SCIM configuration with the new value to make SCIM
302
+ # syncing work again.
303
+ # SSOReady only stores the hash of these bearer tokens. If your customer has lost
304
+ # their copy, you must use this
305
+ # endpoint to generate a new one.
306
+ #
307
+ # @param id [String] The ID of the SCIM directory whose bearer token to rotate.
308
+ # @param request_options [SSOReady::RequestOptions]
309
+ # @return [SSOReady::RotateSCIMDirectoryBearerTokenResponse]
310
+ # @example
311
+ # api = SSOReady::Client.new(
312
+ # environment: SSOReady::Environment::DEFAULT,
313
+ # base_url: "https://api.example.com",
314
+ # api_key: "YOUR_AUTH_TOKEN"
315
+ # )
316
+ # api.management.scim_directories.rotate_scim_directory_bearer_token(id: "id")
317
+ def rotate_scim_directory_bearer_token(id:, request_options: nil)
318
+ Async do
319
+ response = @request_client.conn.post do |req|
320
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
321
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
322
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
323
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim-directories/#{id}/rotate-bearer-token"
324
+ end
325
+ SSOReady::RotateSCIMDirectoryBearerTokenResponse.from_json(json_object: response.body)
326
+ end
327
+ end
328
+ end
329
+ end
330
+ end