Skip to content

Latest commit

 

History

History
384 lines (269 loc) · 23.2 KB

File metadata and controls

384 lines (269 loc) · 23.2 KB

EnterpriseConnections

Overview

Available Operations

  • list - List enterprise connections
  • create - Create an enterprise connection
  • get - Retrieve an enterprise connection
  • update - Update an enterprise connection
  • delete - Delete an enterprise connection
  • listTestRuns - List enterprise connection test runs
  • createTestRun - Create an enterprise connection test run

list

Returns the list of enterprise connections for the instance. Results can be paginated using the optional limit and offset query parameters.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ListEnterpriseConnectionsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        ListEnterpriseConnectionsResponse res = sdk.enterpriseConnections().list()
                .limit(10L)
                .offset(0L)
                .call();

        if (res.enterpriseConnections().isPresent()) {
            System.out.println(res.enterpriseConnections().get());
        }
    }
}

Parameters

Parameter Type Required Description
limit Optional<Long> Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
offset Optional<Long> Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.
organizationId Optional<String> Filter enterprise connections by organization ID
active Optional<Boolean> Filter by active status. If true, only active connections are returned. If false, only inactive connections are returned. If omitted, all connections are returned.

Response

ListEnterpriseConnectionsResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402, 403, 422 application/json
models/errors/SDKError 4XX, 5XX */*

create

Create a new enterprise connection.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateEnterpriseConnectionResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        CreateEnterpriseConnectionResponse res = sdk.enterpriseConnections().create()
                .call();

        if (res.enterpriseConnection().isPresent()) {
            System.out.println(res.enterpriseConnection().get());
        }
    }
}

Parameters

Parameter Type Required Description
request CreateEnterpriseConnectionRequestBody ✔️ The request object to use for the request.

Response

CreateEnterpriseConnectionResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402, 403, 404, 409, 422 application/json
models/errors/SDKError 4XX, 5XX */*

get

Fetches the enterprise connection whose ID matches the provided enterprise_connection_id in the path.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetEnterpriseConnectionResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetEnterpriseConnectionResponse res = sdk.enterpriseConnections().get()
                .enterpriseConnectionId("<id>")
                .call();

        if (res.enterpriseConnection().isPresent()) {
            System.out.println(res.enterpriseConnection().get());
        }
    }
}

Parameters

Parameter Type Required Description
enterpriseConnectionId String ✔️ The ID of the enterprise connection

Response

GetEnterpriseConnectionResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402, 403, 404 application/json
models/errors/SDKError 4XX, 5XX */*

update

Updates the enterprise connection whose ID matches the provided enterprise_connection_id in the path. When enabling the connection (setting active to true), any existing verified organization domains that match the connection's domains (e.g. used for enrollment modes like automatic invitation) may be deleted so the connection can be enabled.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UpdateEnterpriseConnectionRequestBody;
import com.clerk.backend_api.models.operations.UpdateEnterpriseConnectionResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        UpdateEnterpriseConnectionResponse res = sdk.enterpriseConnections().update()
                .enterpriseConnectionId("<id>")
                .requestBody(UpdateEnterpriseConnectionRequestBody.builder()
                    .build())
                .call();

        if (res.enterpriseConnection().isPresent()) {
            System.out.println(res.enterpriseConnection().get());
        }
    }
}

Parameters

Parameter Type Required Description
enterpriseConnectionId String ✔️ The ID of the enterprise connection to update
requestBody UpdateEnterpriseConnectionRequestBody ✔️ N/A

Response

UpdateEnterpriseConnectionResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 402, 403, 404, 422 application/json
models/errors/SDKError 4XX, 5XX */*

delete

Deletes the enterprise connection whose ID matches the provided enterprise_connection_id in the path.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteEnterpriseConnectionResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        DeleteEnterpriseConnectionResponse res = sdk.enterpriseConnections().delete()
                .enterpriseConnectionId("<id>")
                .call();

        if (res.deletedObject().isPresent()) {
            System.out.println(res.deletedObject().get());
        }
    }
}

Parameters

Parameter Type Required Description
enterpriseConnectionId String ✔️ The ID of the enterprise connection to delete

Response

DeleteEnterpriseConnectionResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402, 403, 404 application/json
models/errors/SDKError 4XX, 5XX */*

listTestRuns

Returns a paginated list of SAML or OIDC debug test runs for an enterprise connection.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ListEnterpriseConnectionTestRunsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        ListEnterpriseConnectionTestRunsResponse res = sdk.enterpriseConnections().listTestRuns()
                .enterpriseConnectionId("<id>")
                .limit(10L)
                .offset(0L)
                .call();

        if (res.enterpriseConnectionTestRuns().isPresent()) {
            System.out.println(res.enterpriseConnectionTestRuns().get());
        }
    }
}

Parameters

Parameter Type Required Description
enterpriseConnectionId String ✔️ The ID of the enterprise connection
status List<ListEnterpriseConnectionTestRunsQueryParamStatus> Filter test runs by status (may be repeated)
limit Optional<Long> Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
offset Optional<Long> Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.

Response

ListEnterpriseConnectionTestRunsResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402, 403, 404, 422 application/json
models/errors/SDKError 4XX, 5XX */*

createTestRun

Returns a short-lived URL that starts the IdP test flow for this connection.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateEnterpriseConnectionTestRunResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        CreateEnterpriseConnectionTestRunResponse res = sdk.enterpriseConnections().createTestRun()
                .enterpriseConnectionId("<id>")
                .call();

        if (res.enterpriseConnectionTestRunResponse().isPresent()) {
            System.out.println(res.enterpriseConnectionTestRunResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
enterpriseConnectionId String ✔️ The ID of the enterprise connection

Response

CreateEnterpriseConnectionTestRunResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402, 403, 404 application/json
models/errors/SDKError 4XX, 5XX */*