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,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "../../types/create_setup_url_response"
5
+ require "async"
6
+
7
+ module SSOReady
8
+ module Management
9
+ class SetupURLsClient
10
+ # @return [SSOReady::RequestClient]
11
+ attr_reader :request_client
12
+
13
+ # @param request_client [SSOReady::RequestClient]
14
+ # @return [SSOReady::Management::SetupURLsClient]
15
+ def initialize(request_client:)
16
+ @request_client = request_client
17
+ end
18
+
19
+ # Creates a short-lived self-serve setup URL that you can send to your customer.
20
+ # Setup URLs let your customer configure their SAML settings, SCIM settings, or
21
+ # both.
22
+ #
23
+ # @param organization_id [String] The organization that the setup URL is for.
24
+ # @param can_manage_saml [Boolean] Whether the setup URL lets the user manage SAML connections.
25
+ # @param can_manage_scim [Boolean] Whether the setup URL lets the user manage SCIM directories.
26
+ # @param request_options [SSOReady::RequestOptions]
27
+ # @return [SSOReady::CreateSetupURLResponse]
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.setup_urls.create_setup_url
35
+ def create_setup_url(organization_id: nil, can_manage_saml: nil, can_manage_scim: nil, request_options: nil)
36
+ response = @request_client.conn.post 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.body = {
41
+ **(request_options&.additional_body_parameters || {}),
42
+ organizationId: organization_id,
43
+ canManageSaml: can_manage_saml,
44
+ canManageScim: can_manage_scim
45
+ }.compact
46
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/setup-urls"
47
+ end
48
+ SSOReady::CreateSetupURLResponse.from_json(json_object: response.body)
49
+ end
50
+ end
51
+
52
+ class AsyncSetupURLsClient
53
+ # @return [SSOReady::AsyncRequestClient]
54
+ attr_reader :request_client
55
+
56
+ # @param request_client [SSOReady::AsyncRequestClient]
57
+ # @return [SSOReady::Management::AsyncSetupURLsClient]
58
+ def initialize(request_client:)
59
+ @request_client = request_client
60
+ end
61
+
62
+ # Creates a short-lived self-serve setup URL that you can send to your customer.
63
+ # Setup URLs let your customer configure their SAML settings, SCIM settings, or
64
+ # both.
65
+ #
66
+ # @param organization_id [String] The organization that the setup URL is for.
67
+ # @param can_manage_saml [Boolean] Whether the setup URL lets the user manage SAML connections.
68
+ # @param can_manage_scim [Boolean] Whether the setup URL lets the user manage SCIM directories.
69
+ # @param request_options [SSOReady::RequestOptions]
70
+ # @return [SSOReady::CreateSetupURLResponse]
71
+ # @example
72
+ # api = SSOReady::Client.new(
73
+ # environment: SSOReady::Environment::DEFAULT,
74
+ # base_url: "https://api.example.com",
75
+ # api_key: "YOUR_AUTH_TOKEN"
76
+ # )
77
+ # api.management.setup_urls.create_setup_url
78
+ def create_setup_url(organization_id: nil, can_manage_saml: nil, can_manage_scim: nil, request_options: nil)
79
+ Async do
80
+ response = @request_client.conn.post do |req|
81
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
82
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
83
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
84
+ req.body = {
85
+ **(request_options&.additional_body_parameters || {}),
86
+ organizationId: organization_id,
87
+ canManageSaml: can_manage_saml,
88
+ canManageScim: can_manage_scim
89
+ }.compact
90
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/setup-urls"
91
+ end
92
+ SSOReady::CreateSetupURLResponse.from_json(json_object: response.body)
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,170 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../requests"
4
+ require_relative "../types/redeem_saml_access_code_response"
5
+ require_relative "../types/get_saml_redirect_url_response"
6
+ require "async"
7
+
8
+ module SSOReady
9
+ class SAMLClient
10
+ # @return [SSOReady::RequestClient]
11
+ attr_reader :request_client
12
+
13
+ # @param request_client [SSOReady::RequestClient]
14
+ # @return [SSOReady::SAMLClient]
15
+ def initialize(request_client:)
16
+ @request_client = request_client
17
+ end
18
+
19
+ # Exchanges a SAML access code for details about your user's SAML login details.
20
+ #
21
+ # @param saml_access_code [String] The SAML access code to redeem.
22
+ # @param request_options [SSOReady::RequestOptions]
23
+ # @return [SSOReady::RedeemSAMLAccessCodeResponse]
24
+ # @example
25
+ # api = SSOReady::Client.new(
26
+ # environment: SSOReady::Environment::DEFAULT,
27
+ # base_url: "https://api.example.com",
28
+ # api_key: "YOUR_AUTH_TOKEN"
29
+ # )
30
+ # api.saml.redeem_saml_access_code(saml_access_code: "saml_access_code_...")
31
+ def redeem_saml_access_code(saml_access_code: nil, request_options: nil)
32
+ response = @request_client.conn.post do |req|
33
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
34
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
35
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
36
+ req.body = { **(request_options&.additional_body_parameters || {}), samlAccessCode: saml_access_code }.compact
37
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml/redeem"
38
+ end
39
+ SSOReady::RedeemSAMLAccessCodeResponse.from_json(json_object: response.body)
40
+ end
41
+
42
+ # Gets a SAML initiation URL to redirect your users to.
43
+ #
44
+ # @param saml_connection_id [String] The SAML connection to start a SAML login for.
45
+ # One of `samlConnectionId`, `organizationId`, or `organizationExternalId` must
46
+ # be specified.
47
+ # @param organization_id [String] The ID of the organization to start a SAML login for.
48
+ # The primary SAML connection in this organization will be used for logins.
49
+ # One of `samlConnectionId`, `organizationId`, or `organizationExternalId` must
50
+ # be specified.
51
+ # @param organization_external_id [String] The `externalId` of the organization to start a SAML login for.
52
+ # The primary SAML connection in this organization will be used for logins.
53
+ # One of `samlConnectionId`, `organizationId`, or `organizationExternalId` must
54
+ # be specified.
55
+ # @param state [String] This string will be returned back to you when you redeem this login's SAML
56
+ # access code.
57
+ # You can do anything you like with this `state`, but the most common use-case is
58
+ # to keep track of where to redirect
59
+ # your user back to after logging in with SAML.
60
+ # @param request_options [SSOReady::RequestOptions]
61
+ # @return [SSOReady::GetSAMLRedirectURLResponse]
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.saml.get_saml_redirect_url(organization_external_id: "my_custom_external_id")
69
+ def get_saml_redirect_url(saml_connection_id: nil, organization_id: nil, organization_external_id: nil, state: nil,
70
+ request_options: nil)
71
+ response = @request_client.conn.post do |req|
72
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
73
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
74
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
75
+ req.body = {
76
+ **(request_options&.additional_body_parameters || {}),
77
+ samlConnectionId: saml_connection_id,
78
+ organizationId: organization_id,
79
+ organizationExternalId: organization_external_id,
80
+ state: state
81
+ }.compact
82
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml/redirect"
83
+ end
84
+ SSOReady::GetSAMLRedirectURLResponse.from_json(json_object: response.body)
85
+ end
86
+ end
87
+
88
+ class AsyncSAMLClient
89
+ # @return [SSOReady::AsyncRequestClient]
90
+ attr_reader :request_client
91
+
92
+ # @param request_client [SSOReady::AsyncRequestClient]
93
+ # @return [SSOReady::AsyncSAMLClient]
94
+ def initialize(request_client:)
95
+ @request_client = request_client
96
+ end
97
+
98
+ # Exchanges a SAML access code for details about your user's SAML login details.
99
+ #
100
+ # @param saml_access_code [String] The SAML access code to redeem.
101
+ # @param request_options [SSOReady::RequestOptions]
102
+ # @return [SSOReady::RedeemSAMLAccessCodeResponse]
103
+ # @example
104
+ # api = SSOReady::Client.new(
105
+ # environment: SSOReady::Environment::DEFAULT,
106
+ # base_url: "https://api.example.com",
107
+ # api_key: "YOUR_AUTH_TOKEN"
108
+ # )
109
+ # api.saml.redeem_saml_access_code(saml_access_code: "saml_access_code_...")
110
+ def redeem_saml_access_code(saml_access_code: nil, request_options: nil)
111
+ Async do
112
+ response = @request_client.conn.post do |req|
113
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
114
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
115
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
116
+ req.body = { **(request_options&.additional_body_parameters || {}), samlAccessCode: saml_access_code }.compact
117
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml/redeem"
118
+ end
119
+ SSOReady::RedeemSAMLAccessCodeResponse.from_json(json_object: response.body)
120
+ end
121
+ end
122
+
123
+ # Gets a SAML initiation URL to redirect your users to.
124
+ #
125
+ # @param saml_connection_id [String] The SAML connection to start a SAML login for.
126
+ # One of `samlConnectionId`, `organizationId`, or `organizationExternalId` must
127
+ # be specified.
128
+ # @param organization_id [String] The ID of the organization to start a SAML login for.
129
+ # The primary SAML connection in this organization will be used for logins.
130
+ # One of `samlConnectionId`, `organizationId`, or `organizationExternalId` must
131
+ # be specified.
132
+ # @param organization_external_id [String] The `externalId` of the organization to start a SAML login for.
133
+ # The primary SAML connection in this organization will be used for logins.
134
+ # One of `samlConnectionId`, `organizationId`, or `organizationExternalId` must
135
+ # be specified.
136
+ # @param state [String] This string will be returned back to you when you redeem this login's SAML
137
+ # access code.
138
+ # You can do anything you like with this `state`, but the most common use-case is
139
+ # to keep track of where to redirect
140
+ # your user back to after logging in with SAML.
141
+ # @param request_options [SSOReady::RequestOptions]
142
+ # @return [SSOReady::GetSAMLRedirectURLResponse]
143
+ # @example
144
+ # api = SSOReady::Client.new(
145
+ # environment: SSOReady::Environment::DEFAULT,
146
+ # base_url: "https://api.example.com",
147
+ # api_key: "YOUR_AUTH_TOKEN"
148
+ # )
149
+ # api.saml.get_saml_redirect_url(organization_external_id: "my_custom_external_id")
150
+ def get_saml_redirect_url(saml_connection_id: nil, organization_id: nil, organization_external_id: nil, state: nil,
151
+ request_options: nil)
152
+ Async do
153
+ response = @request_client.conn.post do |req|
154
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
155
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
156
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
157
+ req.body = {
158
+ **(request_options&.additional_body_parameters || {}),
159
+ samlConnectionId: saml_connection_id,
160
+ organizationId: organization_id,
161
+ organizationExternalId: organization_external_id,
162
+ state: state
163
+ }.compact
164
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/saml/redirect"
165
+ end
166
+ SSOReady::GetSAMLRedirectURLResponse.from_json(json_object: response.body)
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,296 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../requests"
4
+ require_relative "../types/list_scim_groups_response"
5
+ require_relative "../types/get_scim_group_response"
6
+ require_relative "../types/list_scim_users_response"
7
+ require_relative "../types/get_scim_user_response"
8
+ require "async"
9
+
10
+ module SSOReady
11
+ class SCIMClient
12
+ # @return [SSOReady::RequestClient]
13
+ attr_reader :request_client
14
+
15
+ # @param request_client [SSOReady::RequestClient]
16
+ # @return [SSOReady::SCIMClient]
17
+ def initialize(request_client:)
18
+ @request_client = request_client
19
+ end
20
+
21
+ # Gets a list of SCIM groups in a SCIM directory.
22
+ #
23
+ # @param scim_directory_id [String] The SCIM directory to list from.
24
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
25
+ # specified.
26
+ # @param organization_id [String] The ID of the organization to list from. The primary SCIM directory of this
27
+ # organization is used.
28
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
29
+ # specified.
30
+ # @param organization_external_id [String] The `externalId` of the organization to list from. The primary SCIM directory of
31
+ # this organization is used.
32
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
33
+ # specified.
34
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
35
+ # @param request_options [SSOReady::RequestOptions]
36
+ # @return [SSOReady::ListSCIMGroupsResponse]
37
+ # @example
38
+ # api = SSOReady::Client.new(
39
+ # environment: SSOReady::Environment::DEFAULT,
40
+ # base_url: "https://api.example.com",
41
+ # api_key: "YOUR_AUTH_TOKEN"
42
+ # )
43
+ # api.scim.list_scim_groups(organization_external_id: "my_custom_external_id")
44
+ def list_scim_groups(scim_directory_id: nil, organization_id: nil, organization_external_id: nil, page_token: nil,
45
+ request_options: nil)
46
+ response = @request_client.conn.get do |req|
47
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
48
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
49
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
50
+ req.params = {
51
+ **(request_options&.additional_query_parameters || {}),
52
+ "scimDirectoryId": scim_directory_id,
53
+ "organizationId": organization_id,
54
+ "organizationExternalId": organization_external_id,
55
+ "pageToken": page_token
56
+ }.compact
57
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/groups"
58
+ end
59
+ SSOReady::ListSCIMGroupsResponse.from_json(json_object: response.body)
60
+ end
61
+
62
+ # Gets a SCIM group in a SCIM directory.
63
+ #
64
+ # @param id [String] ID of the SCIM group to get.
65
+ # @param request_options [SSOReady::RequestOptions]
66
+ # @return [SSOReady::GetSCIMGroupResponse]
67
+ # @example
68
+ # api = SSOReady::Client.new(
69
+ # environment: SSOReady::Environment::DEFAULT,
70
+ # base_url: "https://api.example.com",
71
+ # api_key: "YOUR_AUTH_TOKEN"
72
+ # )
73
+ # api.scim.get_scim_group(id: "scim_group_...")
74
+ def get_scim_group(id:, request_options: nil)
75
+ response = @request_client.conn.get do |req|
76
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
77
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
78
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
79
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/groups/#{id}"
80
+ end
81
+ SSOReady::GetSCIMGroupResponse.from_json(json_object: response.body)
82
+ end
83
+
84
+ # Gets a list of SCIM users in a SCIM directory.
85
+ #
86
+ # @param scim_directory_id [String] The SCIM directory to list from.
87
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
88
+ # specified.
89
+ # @param organization_id [String] The ID of the organization to list from. The primary SCIM directory of this
90
+ # organization is used.
91
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
92
+ # specified.
93
+ # @param organization_external_id [String] The `externalId` of the organization to list from. The primary SCIM directory of
94
+ # this organization is used.
95
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
96
+ # specified.
97
+ # @param scim_group_id [String] If specified, only users that are members of this SCIM group are returned.
98
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
99
+ # @param request_options [SSOReady::RequestOptions]
100
+ # @return [SSOReady::ListSCIMUsersResponse]
101
+ # @example
102
+ # api = SSOReady::Client.new(
103
+ # environment: SSOReady::Environment::DEFAULT,
104
+ # base_url: "https://api.example.com",
105
+ # api_key: "YOUR_AUTH_TOKEN"
106
+ # )
107
+ # api.scim.list_scim_users(organization_external_id: "my_custom_external_id")
108
+ def list_scim_users(scim_directory_id: nil, organization_id: nil, organization_external_id: nil,
109
+ scim_group_id: nil, page_token: nil, request_options: nil)
110
+ response = @request_client.conn.get do |req|
111
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
112
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
113
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
114
+ req.params = {
115
+ **(request_options&.additional_query_parameters || {}),
116
+ "scimDirectoryId": scim_directory_id,
117
+ "organizationId": organization_id,
118
+ "organizationExternalId": organization_external_id,
119
+ "scimGroupId": scim_group_id,
120
+ "pageToken": page_token
121
+ }.compact
122
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/users"
123
+ end
124
+ SSOReady::ListSCIMUsersResponse.from_json(json_object: response.body)
125
+ end
126
+
127
+ # Gets a SCIM user.
128
+ #
129
+ # @param id [String] ID of the SCIM user to get.
130
+ # @param request_options [SSOReady::RequestOptions]
131
+ # @return [SSOReady::GetSCIMUserResponse]
132
+ # @example
133
+ # api = SSOReady::Client.new(
134
+ # environment: SSOReady::Environment::DEFAULT,
135
+ # base_url: "https://api.example.com",
136
+ # api_key: "YOUR_AUTH_TOKEN"
137
+ # )
138
+ # api.scim.get_scim_user(id: "scim_user_...")
139
+ def get_scim_user(id:, request_options: nil)
140
+ response = @request_client.conn.get do |req|
141
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
142
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
143
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
144
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/users/#{id}"
145
+ end
146
+ SSOReady::GetSCIMUserResponse.from_json(json_object: response.body)
147
+ end
148
+ end
149
+
150
+ class AsyncSCIMClient
151
+ # @return [SSOReady::AsyncRequestClient]
152
+ attr_reader :request_client
153
+
154
+ # @param request_client [SSOReady::AsyncRequestClient]
155
+ # @return [SSOReady::AsyncSCIMClient]
156
+ def initialize(request_client:)
157
+ @request_client = request_client
158
+ end
159
+
160
+ # Gets a list of SCIM groups in a SCIM directory.
161
+ #
162
+ # @param scim_directory_id [String] The SCIM directory to list from.
163
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
164
+ # specified.
165
+ # @param organization_id [String] The ID of the organization to list from. The primary SCIM directory of this
166
+ # organization is used.
167
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
168
+ # specified.
169
+ # @param organization_external_id [String] The `externalId` of the organization to list from. The primary SCIM directory of
170
+ # this organization is used.
171
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
172
+ # specified.
173
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
174
+ # @param request_options [SSOReady::RequestOptions]
175
+ # @return [SSOReady::ListSCIMGroupsResponse]
176
+ # @example
177
+ # api = SSOReady::Client.new(
178
+ # environment: SSOReady::Environment::DEFAULT,
179
+ # base_url: "https://api.example.com",
180
+ # api_key: "YOUR_AUTH_TOKEN"
181
+ # )
182
+ # api.scim.list_scim_groups(organization_external_id: "my_custom_external_id")
183
+ def list_scim_groups(scim_directory_id: nil, organization_id: nil, organization_external_id: nil, page_token: nil,
184
+ request_options: nil)
185
+ Async do
186
+ response = @request_client.conn.get do |req|
187
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
188
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
189
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
190
+ req.params = {
191
+ **(request_options&.additional_query_parameters || {}),
192
+ "scimDirectoryId": scim_directory_id,
193
+ "organizationId": organization_id,
194
+ "organizationExternalId": organization_external_id,
195
+ "pageToken": page_token
196
+ }.compact
197
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/groups"
198
+ end
199
+ SSOReady::ListSCIMGroupsResponse.from_json(json_object: response.body)
200
+ end
201
+ end
202
+
203
+ # Gets a SCIM group in a SCIM directory.
204
+ #
205
+ # @param id [String] ID of the SCIM group to get.
206
+ # @param request_options [SSOReady::RequestOptions]
207
+ # @return [SSOReady::GetSCIMGroupResponse]
208
+ # @example
209
+ # api = SSOReady::Client.new(
210
+ # environment: SSOReady::Environment::DEFAULT,
211
+ # base_url: "https://api.example.com",
212
+ # api_key: "YOUR_AUTH_TOKEN"
213
+ # )
214
+ # api.scim.get_scim_group(id: "scim_group_...")
215
+ def get_scim_group(id:, request_options: nil)
216
+ Async do
217
+ response = @request_client.conn.get do |req|
218
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
219
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
220
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
221
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/groups/#{id}"
222
+ end
223
+ SSOReady::GetSCIMGroupResponse.from_json(json_object: response.body)
224
+ end
225
+ end
226
+
227
+ # Gets a list of SCIM users in a SCIM directory.
228
+ #
229
+ # @param scim_directory_id [String] The SCIM directory to list from.
230
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
231
+ # specified.
232
+ # @param organization_id [String] The ID of the organization to list from. The primary SCIM directory of this
233
+ # organization is used.
234
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
235
+ # specified.
236
+ # @param organization_external_id [String] The `externalId` of the organization to list from. The primary SCIM directory of
237
+ # this organization is used.
238
+ # One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be
239
+ # specified.
240
+ # @param scim_group_id [String] If specified, only users that are members of this SCIM group are returned.
241
+ # @param page_token [String] Pagination token. Leave empty to get the first page of results.
242
+ # @param request_options [SSOReady::RequestOptions]
243
+ # @return [SSOReady::ListSCIMUsersResponse]
244
+ # @example
245
+ # api = SSOReady::Client.new(
246
+ # environment: SSOReady::Environment::DEFAULT,
247
+ # base_url: "https://api.example.com",
248
+ # api_key: "YOUR_AUTH_TOKEN"
249
+ # )
250
+ # api.scim.list_scim_users(organization_external_id: "my_custom_external_id")
251
+ def list_scim_users(scim_directory_id: nil, organization_id: nil, organization_external_id: nil,
252
+ scim_group_id: nil, page_token: nil, request_options: nil)
253
+ Async do
254
+ response = @request_client.conn.get do |req|
255
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
256
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
257
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
258
+ req.params = {
259
+ **(request_options&.additional_query_parameters || {}),
260
+ "scimDirectoryId": scim_directory_id,
261
+ "organizationId": organization_id,
262
+ "organizationExternalId": organization_external_id,
263
+ "scimGroupId": scim_group_id,
264
+ "pageToken": page_token
265
+ }.compact
266
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/users"
267
+ end
268
+ SSOReady::ListSCIMUsersResponse.from_json(json_object: response.body)
269
+ end
270
+ end
271
+
272
+ # Gets a SCIM user.
273
+ #
274
+ # @param id [String] ID of the SCIM user to get.
275
+ # @param request_options [SSOReady::RequestOptions]
276
+ # @return [SSOReady::GetSCIMUserResponse]
277
+ # @example
278
+ # api = SSOReady::Client.new(
279
+ # environment: SSOReady::Environment::DEFAULT,
280
+ # base_url: "https://api.example.com",
281
+ # api_key: "YOUR_AUTH_TOKEN"
282
+ # )
283
+ # api.scim.get_scim_user(id: "scim_user_...")
284
+ def get_scim_user(id:, request_options: nil)
285
+ Async do
286
+ response = @request_client.conn.get do |req|
287
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
288
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
289
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
290
+ req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/users/#{id}"
291
+ end
292
+ SSOReady::GetSCIMUserResponse.from_json(json_object: response.body)
293
+ end
294
+ end
295
+ end
296
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "organization"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module SSOReady
8
+ class CreateOrganizationResponse
9
+ # @return [SSOReady::Organization] The created organization.
10
+ attr_reader :organization
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param organization [SSOReady::Organization] The created organization.
20
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
+ # @return [SSOReady::CreateOrganizationResponse]
22
+ def initialize(organization: OMIT, additional_properties: nil)
23
+ @organization = organization if organization != OMIT
24
+ @additional_properties = additional_properties
25
+ @_field_set = { "organization": organization }.reject do |_k, v|
26
+ v == OMIT
27
+ end
28
+ end
29
+
30
+ # Deserialize a JSON object to an instance of CreateOrganizationResponse
31
+ #
32
+ # @param json_object [String]
33
+ # @return [SSOReady::CreateOrganizationResponse]
34
+ def self.from_json(json_object:)
35
+ struct = JSON.parse(json_object, object_class: OpenStruct)
36
+ parsed_json = JSON.parse(json_object)
37
+ if parsed_json["organization"].nil?
38
+ organization = nil
39
+ else
40
+ organization = parsed_json["organization"].to_json
41
+ organization = SSOReady::Organization.from_json(json_object: organization)
42
+ end
43
+ new(organization: organization, additional_properties: struct)
44
+ end
45
+
46
+ # Serialize an instance of CreateOrganizationResponse to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json(*_args)
50
+ @_field_set&.to_json
51
+ end
52
+
53
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
54
+ # hash and check each fields type against the current object's property
55
+ # definitions.
56
+ #
57
+ # @param obj [Object]
58
+ # @return [Void]
59
+ def self.validate_raw(obj:)
60
+ obj.organization.nil? || SSOReady::Organization.validate_raw(obj: obj.organization)
61
+ end
62
+ end
63
+ end