|
8 | 8 | import com.atlan.exception.InvalidRequestException;
|
9 | 9 | import com.atlan.model.admin.AtlanGroup;
|
10 | 10 | import com.atlan.model.admin.SSOMapping;
|
| 11 | +import com.atlan.model.admin.SSOProviderRequest; |
11 | 12 | import com.atlan.net.ApiResource;
|
12 | 13 | import com.atlan.net.RequestOptions;
|
13 | 14 | import com.fasterxml.jackson.core.JsonGenerator;
|
@@ -40,6 +41,54 @@ public SSOEndpoint(AtlanClient client) {
|
40 | 41 | super(client);
|
41 | 42 | }
|
42 | 43 |
|
| 44 | + /** |
| 45 | + * Configure an SSO provider. |
| 46 | + * |
| 47 | + * @param request details of the configuration for an SSO provider |
| 48 | + * @throws AtlanException on any API communication issue |
| 49 | + */ |
| 50 | + public void configure(SSOProviderRequest request) throws AtlanException { |
| 51 | + configure(request, null); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Configure an SSO provider. |
| 56 | + * |
| 57 | + * @param request details of the configuration for an SSO provider |
| 58 | + * @param options to override default client settings |
| 59 | + * @throws AtlanException on any API communication issue |
| 60 | + */ |
| 61 | + public void configure(SSOProviderRequest request, RequestOptions options) throws AtlanException { |
| 62 | + String url = String.format("%s%s", getBaseUrl(), endpoint); |
| 63 | + ApiResource.request(client, ApiResource.RequestMethod.POST, url, request, options); |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Creates a new Atlan SSO mapping. |
| 68 | + * |
| 69 | + * @param ssoAlias name of the SSO provider |
| 70 | + * @param mapping details of the mapping to create |
| 71 | + * @return created SSO mapping |
| 72 | + * @throws AtlanException on any API communication issue |
| 73 | + */ |
| 74 | + public SSOMapping createMapping(String ssoAlias, SSOMapping mapping) throws AtlanException { |
| 75 | + return createMapping(ssoAlias, mapping, null); |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * Creates a new Atlan SSO mapping. |
| 80 | + * |
| 81 | + * @param ssoAlias name of the SSO provider |
| 82 | + * @param mapping details of the mapping to create |
| 83 | + * @param options to override default client settings |
| 84 | + * @return created SSO mapping |
| 85 | + * @throws AtlanException on any API communication issue |
| 86 | + */ |
| 87 | + public SSOMapping createMapping(String ssoAlias, SSOMapping mapping, RequestOptions options) throws AtlanException { |
| 88 | + String url = String.format("%s%s/%s/mappers", getBaseUrl(), endpoint, ssoAlias); |
| 89 | + return ApiResource.request(client, ApiResource.RequestMethod.POST, url, mapping, SSOMapping.class, options); |
| 90 | + } |
| 91 | + |
43 | 92 | /**
|
44 | 93 | * Retrieves all existing Atlan SSO group mappings.
|
45 | 94 | *
|
@@ -132,8 +181,7 @@ public SSOMapping createGroupMapping(String ssoAlias, AtlanGroup group, String s
|
132 | 181 | .identityProviderAlias(ssoAlias)
|
133 | 182 | .identityProviderMapper(IDP_GROUP_MAPPER)
|
134 | 183 | .build();
|
135 |
| - String url = String.format("%s%s/%s/mappers", getBaseUrl(), endpoint, ssoAlias); |
136 |
| - return ApiResource.request(client, ApiResource.RequestMethod.POST, url, request, SSOMapping.class, options); |
| 184 | + return createMapping(ssoAlias, request, options); |
137 | 185 | }
|
138 | 186 |
|
139 | 187 | /**
|
|
0 commit comments