Class: Auth0::Connections::Client
- Inherits:
-
Object
- Object
- Auth0::Connections::Client
- Defined in:
- lib/auth0/connections/client.rb
Instance Method Summary collapse
-
#check_status(request_options: {}, **params) ⇒ untyped
Retrieves the status of an ad/ldap connection referenced by its ‘ID`.
- #clients ⇒ Auth0::Clients::Client
-
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateConnectionResponseContent
Creates a new connection according to the JSON object received in ‘body`.
-
#delete(request_options: {}, **params) ⇒ untyped
Removes a specific [connection](auth0.com/docs/authenticate/identity-providers) from your tenant.
- #directory_provisioning ⇒ Auth0::DirectoryProvisioning::Client
-
#get(request_options: {}, **params) ⇒ Auth0::Types::GetConnectionResponseContent
Retrieve details for a specified [connection](auth0.com/docs/authenticate/identity-providers) along with options that can be used for identity provider configuration.
- #initialize(client:) ⇒ void constructor
- #keys ⇒ Auth0::Keys::Client
-
#list(request_options: {}, **params) ⇒ Auth0::Types::ListConnectionsCheckpointPaginatedResponseContent
Retrieves detailed list of all [connections](auth0.com/docs/authenticate/identity-providers) that match the specified strategy.
- #scim_configuration ⇒ Auth0::SCIMConfiguration::Client
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateConnectionResponseContent
Update details for a specific [connection](auth0.com/docs/authenticate/identity-providers), including option properties for identity provider configuration.
- #users ⇒ Auth0::Users::Client
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/auth0/connections/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#check_status(request_options: {}, **params) ⇒ untyped
Retrieves the status of an ad/ldap connection referenced by its ‘ID`. `200 OK` http status code response is returned when the connection is online, otherwise a `404` status code is returned along with an error message
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/auth0/connections/client.rb', line 263 def check_status(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "connections/#{URI.encode_uri_component(params[:id].to_s)}/status", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#clients ⇒ Auth0::Clients::Client
294 295 296 |
# File 'lib/auth0/connections/client.rb', line 294 def clients @clients ||= Auth0::Connections::Clients::Client.new(client: @client) end |
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateConnectionResponseContent
Creates a new connection according to the JSON object received in ‘body`.
Note: If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/auth0/connections/client.rb', line 104 def create(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "connections", body: Auth0::Connections::Types::CreateConnectionRequestContent.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::CreateConnectionResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Removes a specific [connection](auth0.com/docs/authenticate/identity-providers) from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
Note: If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent [create connection](auth0.com/docs/api/management/v2/connections/post-connections) requests, if they use an identical connection name.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/auth0/connections/client.rb', line 187 def delete(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "connections/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#directory_provisioning ⇒ Auth0::DirectoryProvisioning::Client
284 285 286 |
# File 'lib/auth0/connections/client.rb', line 284 def directory_provisioning @directory_provisioning ||= Auth0::Connections::DirectoryProvisioning::Client.new(client: @client) end |
#get(request_options: {}, **params) ⇒ Auth0::Types::GetConnectionResponseContent
Retrieve details for a specified [connection](auth0.com/docs/authenticate/identity-providers) along with options that can be used for identity provider configuration.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/auth0/connections/client.rb', line 142 def get(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["fields"] = params[:fields] if params.key?(:fields) query_params["include_fields"] = params[:include_fields] if params.key?(:include_fields) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "connections/#{URI.encode_uri_component(params[:id].to_s)}", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::GetConnectionResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#keys ⇒ Auth0::Keys::Client
299 300 301 |
# File 'lib/auth0/connections/client.rb', line 299 def keys @keys ||= Auth0::Connections::Keys::Client.new(client: @client) end |
#list(request_options: {}, **params) ⇒ Auth0::Types::ListConnectionsCheckpointPaginatedResponseContent
Retrieves detailed list of all [connections](auth0.com/docs/authenticate/identity-providers) that match the specified strategy. If no strategy is provided, all connections within your tenant are retrieved. This action can accept a list of fields to include or exclude from the resulting list of connections.
This endpoint supports two types of pagination:
-
Offset pagination
-
Checkpoint pagination
Checkpoint pagination must be used if you need to retrieve more than 1000 connections.
**Checkpoint Pagination**
To search by checkpoint, use the following parameters:
-
‘from`: Optional id from which to start selection.
-
‘take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50.
Note: The first time you call this endpoint using checkpoint pagination, omit the ‘from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/auth0/connections/client.rb', line 50 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["from"] = params[:from] if params.key?(:from) query_params["take"] = params.fetch(:take, 50) query_params["strategy"] = params[:strategy] if params.key?(:strategy) query_params["name"] = params[:name] if params.key?(:name) query_params["fields"] = params[:fields] if params.key?(:fields) query_params["include_fields"] = params[:include_fields] if params.key?(:include_fields) Auth0::Internal::CursorItemIterator.new( cursor_field: :next_, item_field: :connections, initial_cursor: query_params["from"] ) do |next_cursor| query_params["from"] = next_cursor request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "connections", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) parsed_response = Auth0::Types::ListConnectionsCheckpointPaginatedResponseContent.load(response.body) [parsed_response, response] else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end end |
#scim_configuration ⇒ Auth0::SCIMConfiguration::Client
289 290 291 |
# File 'lib/auth0/connections/client.rb', line 289 def scim_configuration @scim_configuration ||= Auth0::Connections::SCIMConfiguration::Client.new(client: @client) end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateConnectionResponseContent
Update details for a specific [connection](auth0.com/docs/authenticate/identity-providers), including option properties for identity provider configuration.
Note: If you use the ‘options` parameter, the entire `options` object is overridden. To avoid partial data or other issues, ensure all parameters are present when using this option.
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/auth0/connections/client.rb', line 223 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Connections::Types::UpdateConnectionRequestContent.new(params).to_h non_body_param_names = %w[id] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "connections/#{URI.encode_uri_component(params[:id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::UpdateConnectionResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#users ⇒ Auth0::Users::Client
304 305 306 |
# File 'lib/auth0/connections/client.rb', line 304 def users @users ||= Auth0::Connections::Users::Client.new(client: @client) end |