diff --git a/checkstyle.xml b/checkstyle.xml index a2b473206b..c48805e69a 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -13,7 +13,7 @@ Java Style - + @@ -80,7 +80,7 @@ Java Style - + diff --git a/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityExamples.java b/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityExamples.java index 78d6736b47..115aa12bb2 100644 --- a/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityExamples.java +++ b/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityExamples.java @@ -77,6 +77,8 @@ protected IamIdentityExamples() { private static String apikeyEtag; private static String svcId; private static String svcIdEtag; + private static String srvIdGroupId; + private static String srvIdGroupEtag; private static String profileId; private static String profileEtag; private static String claimRuleId; @@ -465,6 +467,114 @@ public static void main(String[] args) throws Exception { e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); } + try { + System.out.println("createServiceIdGroup() result:"); + + // begin-create_service_id_group + + CreateServiceIdGroupOptions createServiceIdGroupOptions = new CreateServiceIdGroupOptions.Builder() + .accountId(accountId) + .name(serviceIdName) + .description("Example ServiceIdGroup") + .build(); + + Response response = identityservice.createServiceIdGroup(createServiceIdGroupOptions).execute(); + ServiceIdGroup serviceIdGroup = response.getResult(); + srvIdGroupId = serviceIdGroup.getId(); + + System.out.println(serviceIdGroup); + + // end-create_service_id_group + + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + System.out.println("getServiceIdGroup() result:"); + + // begin-get_service_id_group + + GetServiceIdGroupOptions getServiceIdGroupOptions = new GetServiceIdGroupOptions.Builder() + .id(srvIdGroupId) + .build(); + + Response response = identityservice.getServiceIdGroup(getServiceIdGroupOptions).execute(); + ServiceIdGroup serviceIdGroup = response.getResult(); + srvIdGroupEtag = response.getHeaders().values("Etag").get(0); + + System.out.println(serviceIdGroup); + + // end-get_service_id_group + + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + System.out.println("listServiceIdGroup() result:"); + + // begin-list_service_id_group + + ListServiceIdGroupOptions listServiceIdGroupOptions = new ListServiceIdGroupOptions.Builder() + .accountId(accountId) + .build(); + + Response response = identityservice.listServiceIdGroup(listServiceIdGroupOptions).execute(); + ServiceIdGroupList serviceIdGroupList = response.getResult(); + + System.out.println(serviceIdGroupList); + + // end-list_service_id_group + + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + System.out.println("updateServiceIdGroup() result:"); + + // begin-update_service_id_group + + UpdateServiceIdGroupOptions updateServiceIdGroupOptions = new UpdateServiceIdGroupOptions.Builder() + .id(srvIdGroupId) + .ifMatch(srvIdGroupEtag) + .description("Example ServiceIdGroup updated") + .build(); + + Response response = identityservice.updateServiceIdGroup(updateServiceIdGroupOptions).execute(); + ServiceIdGroup serviceIdGroup = response.getResult(); + + System.out.println(serviceIdGroup); + + // end-update_service_id_group + + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + System.out.println("deleteServiceIdGroup() result:"); + + // begin-delete_service_id_group + + DeleteServiceIdGroupOptions deleteServiceIdGroupOptions = new DeleteServiceIdGroupOptions.Builder() + .id(srvIdGroupId) + .build(); + + identityservice.deleteServiceIdGroup(deleteServiceIdGroupOptions).execute(); + + // end-delete_service_id_group + + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + try { System.out.println("createProfile() result:"); diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentity.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentity.java index 560d50ee35..ebf4b588bb 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentity.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentity.java @@ -12,7 +12,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.98.0-8be2046a-20241205-162752 + * IBM OpenAPI SDK Code Generator Version: 3.105.1-067d600b-20250616-154447 */ package com.ibm.cloud.platform_services.iam_identity.v1; @@ -22,7 +22,6 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.AccountSettingsResponse; import com.ibm.cloud.platform_services.iam_identity.v1.model.AccountSettingsTemplateList; import com.ibm.cloud.platform_services.iam_identity.v1.model.AccountSettingsTemplateResponse; -import com.ibm.cloud.platform_services.iam_identity.v1.model.AllIdentityPreferencesResponse; import com.ibm.cloud.platform_services.iam_identity.v1.model.ApiKey; import com.ibm.cloud.platform_services.iam_identity.v1.model.ApiKeyList; import com.ibm.cloud.platform_services.iam_identity.v1.model.CommitAccountSettingsTemplateOptions; @@ -38,6 +37,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateProfileTemplateOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateProfileTemplateVersionOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateReportOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteAccountSettingsAssignmentOptions; @@ -51,6 +51,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteProfileIdentityOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteProfileOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteProfileTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DisableApiKeyOptions; @@ -76,9 +77,11 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.GetProfileOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetProfileTemplateVersionOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetReportOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.GetServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.IdentityPreferenceResponse; +import com.ibm.cloud.platform_services.iam_identity.v1.model.IdentityPreferencesResponse; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListAccountSettingsAssignmentsOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListAccountSettingsTemplatesOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListApiKeysOptions; @@ -86,6 +89,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.ListLinksOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListProfileTemplatesOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListProfilesOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ListServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListServiceIdsOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListTrustedProfileAssignmentsOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListVersionsOfAccountSettingsTemplateOptions; @@ -102,6 +106,8 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.ReportMfaEnrollmentStatus; import com.ibm.cloud.platform_services.iam_identity.v1.model.ReportReference; import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceId; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroup; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroupList; import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdList; import com.ibm.cloud.platform_services.iam_identity.v1.model.SetProfileIdentitiesOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.SetProfileIdentityOptions; @@ -121,6 +127,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdatePreferenceOnScopeAccountOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateProfileOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateProfileTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UserMfaEnrollments; @@ -189,253 +196,237 @@ public IamIdentity(String serviceName, Authenticator authenticator) { } /** - * Get API keys for a given service or user IAM ID and account ID. + * List service IDs. * - * Returns the list of API key details for a given service or user IAM ID and account ID. Users can manage user API - * keys for themself, or service ID API keys for service IDs they have access to. + * Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs + * they have access to. Note: apikey details are only included in the response when creating a Service ID with an api + * key. * - * @param listApiKeysOptions the {@link ListApiKeysOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiKeyList} + * @param listServiceIdsOptions the {@link ListServiceIdsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceIdList} */ - public ServiceCall listApiKeys(ListApiKeysOptions listApiKeysOptions) { - if (listApiKeysOptions == null) { - listApiKeysOptions = new ListApiKeysOptions.Builder().build(); + public ServiceCall listServiceIds(ListServiceIdsOptions listServiceIdsOptions) { + if (listServiceIdsOptions == null) { + listServiceIdsOptions = new ListServiceIdsOptions.Builder().build(); } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listApiKeys"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listServiceIds"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listApiKeysOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listApiKeysOptions.accountId())); + if (listServiceIdsOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listServiceIdsOptions.accountId())); } - if (listApiKeysOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listApiKeysOptions.iamId())); + if (listServiceIdsOptions.groupId() != null) { + builder.query("group_id", String.valueOf(listServiceIdsOptions.groupId())); } - if (listApiKeysOptions.pagesize() != null) { - builder.query("pagesize", String.valueOf(listApiKeysOptions.pagesize())); + if (listServiceIdsOptions.name() != null) { + builder.query("name", String.valueOf(listServiceIdsOptions.name())); } - if (listApiKeysOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listApiKeysOptions.pagetoken())); + if (listServiceIdsOptions.pagesize() != null) { + builder.query("pagesize", String.valueOf(listServiceIdsOptions.pagesize())); } - if (listApiKeysOptions.scope() != null) { - builder.query("scope", String.valueOf(listApiKeysOptions.scope())); + if (listServiceIdsOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listServiceIdsOptions.pagetoken())); } - if (listApiKeysOptions.type() != null) { - builder.query("type", String.valueOf(listApiKeysOptions.type())); + if (listServiceIdsOptions.sort() != null) { + builder.query("sort", String.valueOf(listServiceIdsOptions.sort())); } - if (listApiKeysOptions.sort() != null) { - builder.query("sort", String.valueOf(listApiKeysOptions.sort())); + if (listServiceIdsOptions.order() != null) { + builder.query("order", String.valueOf(listServiceIdsOptions.order())); } - if (listApiKeysOptions.order() != null) { - builder.query("order", String.valueOf(listApiKeysOptions.order())); + if (listServiceIdsOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listServiceIdsOptions.includeHistory())); } - if (listApiKeysOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listApiKeysOptions.includeHistory())); + if (listServiceIdsOptions.filter() != null) { + builder.query("filter", String.valueOf(listServiceIdsOptions.filter())); } - if (listApiKeysOptions.filter() != null) { - builder.query("filter", String.valueOf(listApiKeysOptions.filter())); + if (listServiceIdsOptions.showGroupId() != null) { + builder.query("show_group_id", String.valueOf(listServiceIdsOptions.showGroupId())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get API keys for a given service or user IAM ID and account ID. + * List service IDs. * - * Returns the list of API key details for a given service or user IAM ID and account ID. Users can manage user API - * keys for themself, or service ID API keys for service IDs they have access to. + * Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs + * they have access to. Note: apikey details are only included in the response when creating a Service ID with an api + * key. * - * @return a {@link ServiceCall} with a result of type {@link ApiKeyList} + * @return a {@link ServiceCall} with a result of type {@link ServiceIdList} */ - public ServiceCall listApiKeys() { - return listApiKeys(null); + public ServiceCall listServiceIds() { + return listServiceIds(null); } /** - * Create an API key. + * Create a service ID. * - * Creates an API key for a UserID or service ID. Users can manage user API keys for themself, or service ID API keys + * Creates a service ID for an IBM Cloud account. Users can manage user API keys for themself, or service ID API keys * for service IDs they have access to. * - * @param createApiKeyOptions the {@link CreateApiKeyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiKey} + * @param createServiceIdOptions the {@link CreateServiceIdOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceId} */ - public ServiceCall createApiKey(CreateApiKeyOptions createApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createApiKeyOptions, - "createApiKeyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createApiKey"); + public ServiceCall createServiceId(CreateServiceIdOptions createServiceIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createServiceIdOptions, + "createServiceIdOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createServiceId"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createApiKeyOptions.entityLock() != null) { - builder.header("Entity-Lock", createApiKeyOptions.entityLock()); + if (createServiceIdOptions.entityLock() != null) { + builder.header("Entity-Lock", createServiceIdOptions.entityLock()); } - if (createApiKeyOptions.entityDisable() != null) { - builder.header("Entity-Disable", createApiKeyOptions.entityDisable()); + if (createServiceIdOptions.showGroupId() != null) { + builder.query("show_group_id", String.valueOf(createServiceIdOptions.showGroupId())); } final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createApiKeyOptions.name()); - contentJson.addProperty("iam_id", createApiKeyOptions.iamId()); - if (createApiKeyOptions.description() != null) { - contentJson.addProperty("description", createApiKeyOptions.description()); - } - if (createApiKeyOptions.accountId() != null) { - contentJson.addProperty("account_id", createApiKeyOptions.accountId()); - } - if (createApiKeyOptions.apikey() != null) { - contentJson.addProperty("apikey", createApiKeyOptions.apikey()); + contentJson.addProperty("account_id", createServiceIdOptions.accountId()); + contentJson.addProperty("name", createServiceIdOptions.name()); + if (createServiceIdOptions.groupId() != null) { + contentJson.addProperty("group_id", createServiceIdOptions.groupId()); } - if (createApiKeyOptions.storeValue() != null) { - contentJson.addProperty("store_value", createApiKeyOptions.storeValue()); + if (createServiceIdOptions.description() != null) { + contentJson.addProperty("description", createServiceIdOptions.description()); } - if (createApiKeyOptions.supportSessions() != null) { - contentJson.addProperty("support_sessions", createApiKeyOptions.supportSessions()); + if (createServiceIdOptions.uniqueInstanceCrns() != null) { + contentJson.add("unique_instance_crns", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createServiceIdOptions.uniqueInstanceCrns())); } - if (createApiKeyOptions.actionWhenLeaked() != null) { - contentJson.addProperty("action_when_leaked", createApiKeyOptions.actionWhenLeaked()); + if (createServiceIdOptions.apikey() != null) { + contentJson.add("apikey", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createServiceIdOptions.apikey())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get details of an API key by its value. + * Get details of a service ID. * - * Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys - * for service IDs they have access to. + * Returns the details of a service ID. Users can manage user API keys for themself, or service ID API keys for + * service IDs they have access to. Note: apikey details are only included in the response when creating a Service ID + * with an api key. * - * @param getApiKeysDetailsOptions the {@link GetApiKeysDetailsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiKey} + * @param getServiceIdOptions the {@link GetServiceIdOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceId} */ - public ServiceCall getApiKeysDetails(GetApiKeysDetailsOptions getApiKeysDetailsOptions) { - if (getApiKeysDetailsOptions == null) { - getApiKeysDetailsOptions = new GetApiKeysDetailsOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/details")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getApiKeysDetails"); + public ServiceCall getServiceId(GetServiceIdOptions getServiceIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getServiceIdOptions, + "getServiceIdOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getServiceIdOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getServiceId"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getApiKeysDetailsOptions.iamApiKey() != null) { - builder.header("IAM-ApiKey", getApiKeysDetailsOptions.iamApiKey()); + if (getServiceIdOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getServiceIdOptions.includeHistory())); } - if (getApiKeysDetailsOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getApiKeysDetailsOptions.includeHistory())); + if (getServiceIdOptions.includeActivity() != null) { + builder.query("include_activity", String.valueOf(getServiceIdOptions.includeActivity())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + if (getServiceIdOptions.showGroupId() != null) { + builder.query("show_group_id", String.valueOf(getServiceIdOptions.showGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get details of an API key by its value. - * - * Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys - * for service IDs they have access to. - * - * @return a {@link ServiceCall} with a result of type {@link ApiKey} - */ - public ServiceCall getApiKeysDetails() { - return getApiKeysDetails(null); - } - - /** - * Get details of an API key. + * Update service ID. * - * Returns the details of an API key. Users can manage user API keys for themself, or service ID API keys for service - * IDs they have access to. + * Updates properties of a service ID. This does NOT affect existing access tokens. Their token content will stay + * unchanged until the access token is refreshed. To update a service ID, pass the property to be modified. To delete + * one property's value, pass the property with an empty value "".Users can manage user API keys for themself, or + * service ID API keys for service IDs they have access to. Note: apikey details are only included in the response + * when creating a Service ID with an apikey. * - * @param getApiKeyOptions the {@link GetApiKeyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiKey} + * @param updateServiceIdOptions the {@link UpdateServiceIdOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceId} */ - public ServiceCall getApiKey(GetApiKeyOptions getApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getApiKeyOptions, - "getApiKeyOptions cannot be null"); + public ServiceCall updateServiceId(UpdateServiceIdOptions updateServiceIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateServiceIdOptions, + "updateServiceIdOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getApiKey"); + pathParamsMap.put("id", updateServiceIdOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateServiceId"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getApiKeyOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getApiKeyOptions.includeHistory())); + builder.header("If-Match", updateServiceIdOptions.ifMatch()); + if (updateServiceIdOptions.showGroupId() != null) { + builder.query("show_group_id", String.valueOf(updateServiceIdOptions.showGroupId())); } - if (getApiKeyOptions.includeActivity() != null) { - builder.query("include_activity", String.valueOf(getApiKeyOptions.includeActivity())); + final JsonObject contentJson = new JsonObject(); + if (updateServiceIdOptions.name() != null) { + contentJson.addProperty("name", updateServiceIdOptions.name()); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + if (updateServiceIdOptions.description() != null) { + contentJson.addProperty("description", updateServiceIdOptions.description()); + } + if (updateServiceIdOptions.uniqueInstanceCrns() != null) { + contentJson.add("unique_instance_crns", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateServiceIdOptions.uniqueInstanceCrns())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Updates an API key. + * Deletes a service ID and associated API keys. * - * Updates properties of an API key. This does NOT affect existing access tokens. Their token content will stay - * unchanged until the access token is refreshed. To update an API key, pass the property to be modified. To delete - * one property's value, pass the property with an empty value "". Users can manage user API keys for themself, or - * service ID API keys for service IDs they have access to. + * Deletes a service ID and all API keys associated to it. Before deleting the service ID, all associated API keys are + * deleted. In case a Delete Conflict (status code 409) a retry of the request may help as the service ID is only + * deleted if the associated API keys were successfully deleted before. Users can manage user API keys for themself, + * or service ID API keys for service IDs they have access to. * - * @param updateApiKeyOptions the {@link UpdateApiKeyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiKey} + * @param deleteServiceIdOptions the {@link DeleteServiceIdOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result */ - public ServiceCall updateApiKey(UpdateApiKeyOptions updateApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateApiKeyOptions, - "updateApiKeyOptions cannot be null"); + public ServiceCall deleteServiceId(DeleteServiceIdOptions deleteServiceIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteServiceIdOptions, + "deleteServiceIdOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", updateApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateApiKey"); + pathParamsMap.put("id", deleteServiceIdOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteServiceId"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateApiKeyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updateApiKeyOptions.name() != null) { - contentJson.addProperty("name", updateApiKeyOptions.name()); - } - if (updateApiKeyOptions.description() != null) { - contentJson.addProperty("description", updateApiKeyOptions.description()); - } - if (updateApiKeyOptions.supportSessions() != null) { - contentJson.addProperty("support_sessions", updateApiKeyOptions.supportSessions()); - } - if (updateApiKeyOptions.actionWhenLeaked() != null) { - contentJson.addProperty("action_when_leaked", updateApiKeyOptions.actionWhenLeaked()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** - * Deletes an API key. + * Lock the service ID. * - * Deletes an API key. Existing tokens will remain valid until expired. Users can manage user API keys for themself, - * or service ID API keys for service IDs they have access to. + * Locks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs they + * have access to. * - * @param deleteApiKeyOptions the {@link DeleteApiKeyOptions} containing the options for the call + * @param lockServiceIdOptions the {@link LockServiceIdOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteApiKey(DeleteApiKeyOptions deleteApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteApiKeyOptions, - "deleteApiKeyOptions cannot be null"); + public ServiceCall lockServiceId(LockServiceIdOptions lockServiceIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(lockServiceIdOptions, + "lockServiceIdOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteApiKey"); + pathParamsMap.put("id", lockServiceIdOptions.id()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}/lock", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "lockServiceId"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -444,21 +435,21 @@ public ServiceCall deleteApiKey(DeleteApiKeyOptions deleteApiKeyOptions) { } /** - * Lock the API key. + * Unlock the service ID. * - * Locks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs they - * have access to. + * Unlocks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs + * they have access to. * - * @param lockApiKeyOptions the {@link LockApiKeyOptions} containing the options for the call + * @param unlockServiceIdOptions the {@link UnlockServiceIdOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall lockApiKey(LockApiKeyOptions lockApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(lockApiKeyOptions, - "lockApiKeyOptions cannot be null"); + public ServiceCall unlockServiceId(UnlockServiceIdOptions unlockServiceIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(unlockServiceIdOptions, + "unlockServiceIdOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", lockApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/lock", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "lockApiKey"); + pathParamsMap.put("id", unlockServiceIdOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}/lock", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "unlockServiceId"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -467,67 +458,141 @@ public ServiceCall lockApiKey(LockApiKeyOptions lockApiKeyOptions) { } /** - * Unlock the API key. + * List service ID groups. * - * Unlocks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs they - * have access to. + * Returns a list of all service ID groups for the given account ID. * - * @param unlockApiKeyOptions the {@link UnlockApiKeyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result + * @param listServiceIdGroupOptions the {@link ListServiceIdGroupOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceIdGroupList} */ - public ServiceCall unlockApiKey(UnlockApiKeyOptions unlockApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(unlockApiKeyOptions, - "unlockApiKeyOptions cannot be null"); + public ServiceCall listServiceIdGroup(ListServiceIdGroupOptions listServiceIdGroupOptions) { + if (listServiceIdGroupOptions == null) { + listServiceIdGroupOptions = new ListServiceIdGroupOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceid_groups")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listServiceIdGroup"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listServiceIdGroupOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listServiceIdGroupOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List service ID groups. + * + * Returns a list of all service ID groups for the given account ID. + * + * @return a {@link ServiceCall} with a result of type {@link ServiceIdGroupList} + */ + public ServiceCall listServiceIdGroup() { + return listServiceIdGroup(null); + } + + /** + * Create a service ID group. + * + * Creates a service ID group for the given account ID. + * + * @param createServiceIdGroupOptions the {@link CreateServiceIdGroupOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceIdGroup} + */ + public ServiceCall createServiceIdGroup(CreateServiceIdGroupOptions createServiceIdGroupOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createServiceIdGroupOptions, + "createServiceIdGroupOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceid_groups")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createServiceIdGroup"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("account_id", createServiceIdGroupOptions.accountId()); + contentJson.addProperty("name", createServiceIdGroupOptions.name()); + if (createServiceIdGroupOptions.description() != null) { + contentJson.addProperty("description", createServiceIdGroupOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get details of a service ID group. + * + * Returns the details of a service ID group. + * + * @param getServiceIdGroupOptions the {@link GetServiceIdGroupOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceIdGroup} + */ + public ServiceCall getServiceIdGroup(GetServiceIdGroupOptions getServiceIdGroupOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getServiceIdGroupOptions, + "getServiceIdGroupOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", unlockApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/lock", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "unlockApiKey"); + pathParamsMap.put("id", getServiceIdGroupOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceid_groups/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getServiceIdGroup"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Disable the API key. + * Update a service ID group. * - * Disable an API key. Users can manage user API keys for themself, or service ID API keys for service IDs they have - * access to. + * Update a service ID group. * - * @param disableApiKeyOptions the {@link DisableApiKeyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result + * @param updateServiceIdGroupOptions the {@link UpdateServiceIdGroupOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceIdGroup} */ - public ServiceCall disableApiKey(DisableApiKeyOptions disableApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(disableApiKeyOptions, - "disableApiKeyOptions cannot be null"); + public ServiceCall updateServiceIdGroup(UpdateServiceIdGroupOptions updateServiceIdGroupOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateServiceIdGroupOptions, + "updateServiceIdGroupOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", disableApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/disable", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "disableApiKey"); + pathParamsMap.put("id", updateServiceIdGroupOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceid_groups/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateServiceIdGroup"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + builder.header("Accept", "application/json"); + builder.header("If-Match", updateServiceIdGroupOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", updateServiceIdGroupOptions.name()); + if (updateServiceIdGroupOptions.description() != null) { + contentJson.addProperty("description", updateServiceIdGroupOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Enable the API key. + * Delete a service ID group. * - * Enable an API key. Users can manage user API keys for themself, or service ID API keys for service IDs they have - * access to. + * Delete a service ID group. * - * @param enableApiKeyOptions the {@link EnableApiKeyOptions} containing the options for the call + * @param deleteServiceIdGroupOptions the {@link DeleteServiceIdGroupOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall enableApiKey(EnableApiKeyOptions enableApiKeyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(enableApiKeyOptions, - "enableApiKeyOptions cannot be null"); + public ServiceCall deleteServiceIdGroup(DeleteServiceIdGroupOptions deleteServiceIdGroupOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteServiceIdGroupOptions, + "deleteServiceIdGroupOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", enableApiKeyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/disable", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "enableApiKey"); + pathParamsMap.put("id", deleteServiceIdGroupOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceid_groups/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteServiceIdGroup"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -536,196 +601,256 @@ public ServiceCall enableApiKey(EnableApiKeyOptions enableApiKeyOptions) { } /** - * List service IDs. + * Get API keys for a given service or user IAM ID and account ID. * - * Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs - * they have access to. Note: apikey details are only included in the response when creating a Service ID with an api - * key. + * Returns the list of API key details for a given service or user IAM ID and account ID. Users can manage user API + * keys for themself, or service ID API keys for service IDs they have access to. * - * @param listServiceIdsOptions the {@link ListServiceIdsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ServiceIdList} + * @param listApiKeysOptions the {@link ListApiKeysOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ApiKeyList} */ - public ServiceCall listServiceIds(ListServiceIdsOptions listServiceIdsOptions) { - if (listServiceIdsOptions == null) { - listServiceIdsOptions = new ListServiceIdsOptions.Builder().build(); + public ServiceCall listApiKeys(ListApiKeysOptions listApiKeysOptions) { + if (listApiKeysOptions == null) { + listApiKeysOptions = new ListApiKeysOptions.Builder().build(); } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listServiceIds"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listApiKeys"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listServiceIdsOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listServiceIdsOptions.accountId())); + if (listApiKeysOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listApiKeysOptions.accountId())); } - if (listServiceIdsOptions.name() != null) { - builder.query("name", String.valueOf(listServiceIdsOptions.name())); + if (listApiKeysOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listApiKeysOptions.iamId())); } - if (listServiceIdsOptions.pagesize() != null) { - builder.query("pagesize", String.valueOf(listServiceIdsOptions.pagesize())); + if (listApiKeysOptions.pagesize() != null) { + builder.query("pagesize", String.valueOf(listApiKeysOptions.pagesize())); } - if (listServiceIdsOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listServiceIdsOptions.pagetoken())); + if (listApiKeysOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listApiKeysOptions.pagetoken())); } - if (listServiceIdsOptions.sort() != null) { - builder.query("sort", String.valueOf(listServiceIdsOptions.sort())); + if (listApiKeysOptions.scope() != null) { + builder.query("scope", String.valueOf(listApiKeysOptions.scope())); } - if (listServiceIdsOptions.order() != null) { - builder.query("order", String.valueOf(listServiceIdsOptions.order())); + if (listApiKeysOptions.type() != null) { + builder.query("type", String.valueOf(listApiKeysOptions.type())); } - if (listServiceIdsOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listServiceIdsOptions.includeHistory())); + if (listApiKeysOptions.sort() != null) { + builder.query("sort", String.valueOf(listApiKeysOptions.sort())); } - if (listServiceIdsOptions.filter() != null) { - builder.query("filter", String.valueOf(listServiceIdsOptions.filter())); + if (listApiKeysOptions.order() != null) { + builder.query("order", String.valueOf(listApiKeysOptions.order())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + if (listApiKeysOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listApiKeysOptions.includeHistory())); + } + if (listApiKeysOptions.filter() != null) { + builder.query("filter", String.valueOf(listApiKeysOptions.filter())); + } + if (listApiKeysOptions.groupId() != null) { + builder.query("group_id", String.valueOf(listApiKeysOptions.groupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List service IDs. + * Get API keys for a given service or user IAM ID and account ID. * - * Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs - * they have access to. Note: apikey details are only included in the response when creating a Service ID with an api - * key. + * Returns the list of API key details for a given service or user IAM ID and account ID. Users can manage user API + * keys for themself, or service ID API keys for service IDs they have access to. * - * @return a {@link ServiceCall} with a result of type {@link ServiceIdList} + * @return a {@link ServiceCall} with a result of type {@link ApiKeyList} */ - public ServiceCall listServiceIds() { - return listServiceIds(null); + public ServiceCall listApiKeys() { + return listApiKeys(null); } /** - * Create a service ID. + * Create an API key. * - * Creates a service ID for an IBM Cloud account. Users can manage user API keys for themself, or service ID API keys + * Creates an API key for a UserID or service ID. Users can manage user API keys for themself, or service ID API keys * for service IDs they have access to. * - * @param createServiceIdOptions the {@link CreateServiceIdOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ServiceId} + * @param createApiKeyOptions the {@link CreateApiKeyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ApiKey} */ - public ServiceCall createServiceId(CreateServiceIdOptions createServiceIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createServiceIdOptions, - "createServiceIdOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createServiceId"); + public ServiceCall createApiKey(CreateApiKeyOptions createApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createApiKeyOptions, + "createApiKeyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createApiKey"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createServiceIdOptions.entityLock() != null) { - builder.header("Entity-Lock", createServiceIdOptions.entityLock()); + if (createApiKeyOptions.entityLock() != null) { + builder.header("Entity-Lock", createApiKeyOptions.entityLock()); + } + if (createApiKeyOptions.entityDisable() != null) { + builder.header("Entity-Disable", createApiKeyOptions.entityDisable()); } final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("account_id", createServiceIdOptions.accountId()); - contentJson.addProperty("name", createServiceIdOptions.name()); - if (createServiceIdOptions.description() != null) { - contentJson.addProperty("description", createServiceIdOptions.description()); + contentJson.addProperty("name", createApiKeyOptions.name()); + contentJson.addProperty("iam_id", createApiKeyOptions.iamId()); + if (createApiKeyOptions.description() != null) { + contentJson.addProperty("description", createApiKeyOptions.description()); } - if (createServiceIdOptions.uniqueInstanceCrns() != null) { - contentJson.add("unique_instance_crns", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createServiceIdOptions.uniqueInstanceCrns())); + if (createApiKeyOptions.accountId() != null) { + contentJson.addProperty("account_id", createApiKeyOptions.accountId()); } - if (createServiceIdOptions.apikey() != null) { - contentJson.add("apikey", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createServiceIdOptions.apikey())); + if (createApiKeyOptions.apikey() != null) { + contentJson.addProperty("apikey", createApiKeyOptions.apikey()); + } + if (createApiKeyOptions.storeValue() != null) { + contentJson.addProperty("store_value", createApiKeyOptions.storeValue()); + } + if (createApiKeyOptions.supportSessions() != null) { + contentJson.addProperty("support_sessions", createApiKeyOptions.supportSessions()); + } + if (createApiKeyOptions.actionWhenLeaked() != null) { + contentJson.addProperty("action_when_leaked", createApiKeyOptions.actionWhenLeaked()); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get details of a service ID. + * Get details of an API key by its value. * - * Returns the details of a service ID. Users can manage user API keys for themself, or service ID API keys for - * service IDs they have access to. Note: apikey details are only included in the response when creating a Service ID - * with an api key. + * Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys + * for service IDs they have access to. * - * @param getServiceIdOptions the {@link GetServiceIdOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ServiceId} + * @param getApiKeysDetailsOptions the {@link GetApiKeysDetailsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ApiKey} */ - public ServiceCall getServiceId(GetServiceIdOptions getServiceIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getServiceIdOptions, - "getServiceIdOptions cannot be null"); + public ServiceCall getApiKeysDetails(GetApiKeysDetailsOptions getApiKeysDetailsOptions) { + if (getApiKeysDetailsOptions == null) { + getApiKeysDetailsOptions = new GetApiKeysDetailsOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/details")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getApiKeysDetails"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getApiKeysDetailsOptions.iamApiKey() != null) { + builder.header("IAM-ApiKey", getApiKeysDetailsOptions.iamApiKey()); + } + if (getApiKeysDetailsOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getApiKeysDetailsOptions.includeHistory())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get details of an API key by its value. + * + * Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys + * for service IDs they have access to. + * + * @return a {@link ServiceCall} with a result of type {@link ApiKey} + */ + public ServiceCall getApiKeysDetails() { + return getApiKeysDetails(null); + } + + /** + * Get details of an API key. + * + * Returns the details of an API key. Users can manage user API keys for themself, or service ID API keys for service + * IDs they have access to. + * + * @param getApiKeyOptions the {@link GetApiKeyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ApiKey} + */ + public ServiceCall getApiKey(GetApiKeyOptions getApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getApiKeyOptions, + "getApiKeyOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getServiceIdOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getServiceId"); + pathParamsMap.put("id", getApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getApiKey"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getServiceIdOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getServiceIdOptions.includeHistory())); + if (getApiKeyOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getApiKeyOptions.includeHistory())); } - if (getServiceIdOptions.includeActivity() != null) { - builder.query("include_activity", String.valueOf(getServiceIdOptions.includeActivity())); + if (getApiKeyOptions.includeActivity() != null) { + builder.query("include_activity", String.valueOf(getApiKeyOptions.includeActivity())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update service ID. + * Updates an API key. * - * Updates properties of a service ID. This does NOT affect existing access tokens. Their token content will stay - * unchanged until the access token is refreshed. To update a service ID, pass the property to be modified. To delete - * one property's value, pass the property with an empty value "".Users can manage user API keys for themself, or - * service ID API keys for service IDs they have access to. Note: apikey details are only included in the response - * when creating a Service ID with an apikey. + * Updates properties of an API key. This does NOT affect existing access tokens. Their token content will stay + * unchanged until the access token is refreshed. To update an API key, pass the property to be modified. To delete + * one property's value, pass the property with an empty value "". Users can manage user API keys for themself, or + * service ID API keys for service IDs they have access to. * - * @param updateServiceIdOptions the {@link UpdateServiceIdOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ServiceId} + * @param updateApiKeyOptions the {@link UpdateApiKeyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ApiKey} */ - public ServiceCall updateServiceId(UpdateServiceIdOptions updateServiceIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateServiceIdOptions, - "updateServiceIdOptions cannot be null"); + public ServiceCall updateApiKey(UpdateApiKeyOptions updateApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateApiKeyOptions, + "updateApiKeyOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", updateServiceIdOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateServiceId"); + pathParamsMap.put("id", updateApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateApiKey"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - builder.header("If-Match", updateServiceIdOptions.ifMatch()); + builder.header("If-Match", updateApiKeyOptions.ifMatch()); final JsonObject contentJson = new JsonObject(); - if (updateServiceIdOptions.name() != null) { - contentJson.addProperty("name", updateServiceIdOptions.name()); + if (updateApiKeyOptions.name() != null) { + contentJson.addProperty("name", updateApiKeyOptions.name()); } - if (updateServiceIdOptions.description() != null) { - contentJson.addProperty("description", updateServiceIdOptions.description()); + if (updateApiKeyOptions.description() != null) { + contentJson.addProperty("description", updateApiKeyOptions.description()); } - if (updateServiceIdOptions.uniqueInstanceCrns() != null) { - contentJson.add("unique_instance_crns", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateServiceIdOptions.uniqueInstanceCrns())); + if (updateApiKeyOptions.supportSessions() != null) { + contentJson.addProperty("support_sessions", updateApiKeyOptions.supportSessions()); + } + if (updateApiKeyOptions.actionWhenLeaked() != null) { + contentJson.addProperty("action_when_leaked", updateApiKeyOptions.actionWhenLeaked()); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Deletes a service ID and associated API keys. + * Deletes an API key. * - * Deletes a service ID and all API keys associated to it. Before deleting the service ID, all associated API keys are - * deleted. In case a Delete Conflict (status code 409) a retry of the request may help as the service ID is only - * deleted if the associated API keys were successfully deleted before. Users can manage user API keys for themself, + * Deletes an API key. Existing tokens will remain valid until expired. Users can manage user API keys for themself, * or service ID API keys for service IDs they have access to. * - * @param deleteServiceIdOptions the {@link DeleteServiceIdOptions} containing the options for the call + * @param deleteApiKeyOptions the {@link DeleteApiKeyOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteServiceId(DeleteServiceIdOptions deleteServiceIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteServiceIdOptions, - "deleteServiceIdOptions cannot be null"); + public ServiceCall deleteApiKey(DeleteApiKeyOptions deleteApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteApiKeyOptions, + "deleteApiKeyOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteServiceIdOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteServiceId"); + pathParamsMap.put("id", deleteApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteApiKey"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -734,21 +859,21 @@ public ServiceCall deleteServiceId(DeleteServiceIdOptions deleteServiceIdO } /** - * Lock the service ID. + * Lock the API key. * - * Locks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs they + * Locks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs they * have access to. * - * @param lockServiceIdOptions the {@link LockServiceIdOptions} containing the options for the call + * @param lockApiKeyOptions the {@link LockApiKeyOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall lockServiceId(LockServiceIdOptions lockServiceIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(lockServiceIdOptions, - "lockServiceIdOptions cannot be null"); + public ServiceCall lockApiKey(LockApiKeyOptions lockApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(lockApiKeyOptions, + "lockApiKeyOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", lockServiceIdOptions.id()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}/lock", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "lockServiceId"); + pathParamsMap.put("id", lockApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/lock", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "lockApiKey"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -757,21 +882,67 @@ public ServiceCall lockServiceId(LockServiceIdOptions lockServiceIdOptions } /** - * Unlock the service ID. + * Unlock the API key. * - * Unlocks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs - * they have access to. + * Unlocks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs they + * have access to. * - * @param unlockServiceIdOptions the {@link UnlockServiceIdOptions} containing the options for the call + * @param unlockApiKeyOptions the {@link UnlockApiKeyOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall unlockServiceId(UnlockServiceIdOptions unlockServiceIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(unlockServiceIdOptions, - "unlockServiceIdOptions cannot be null"); + public ServiceCall unlockApiKey(UnlockApiKeyOptions unlockApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(unlockApiKeyOptions, + "unlockApiKeyOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", unlockServiceIdOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/serviceids/{id}/lock", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "unlockServiceId"); + pathParamsMap.put("id", unlockApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/lock", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "unlockApiKey"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Disable the API key. + * + * Disable an API key. Users can manage user API keys for themself, or service ID API keys for service IDs they have + * access to. + * + * @param disableApiKeyOptions the {@link DisableApiKeyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall disableApiKey(DisableApiKeyOptions disableApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(disableApiKeyOptions, + "disableApiKeyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", disableApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/disable", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "disableApiKey"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Enable the API key. + * + * Enable an API key. Users can manage user API keys for themself, or service ID API keys for service IDs they have + * access to. + * + * @param enableApiKeyOptions the {@link EnableApiKeyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall enableApiKey(EnableApiKeyOptions enableApiKeyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(enableApiKeyOptions, + "enableApiKeyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", enableApiKeyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/apikeys/{id}/disable", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "enableApiKey"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -802,6 +973,9 @@ public ServiceCall createProfile(CreateProfileOptions createProf if (createProfileOptions.description() != null) { contentJson.addProperty("description", createProfileOptions.description()); } + if (createProfileOptions.email() != null) { + contentJson.addProperty("email", createProfileOptions.email()); + } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -908,6 +1082,9 @@ public ServiceCall updateProfile(UpdateProfileOptions updateProf if (updateProfileOptions.description() != null) { contentJson.addProperty("description", updateProfileOptions.description()); } + if (updateProfileOptions.email() != null) { + contentJson.addProperty("email", updateProfileOptions.email()); + } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -1260,9 +1437,11 @@ public ServiceCall setProfileIdentities(SetProfileIde /** * Add a specific identity that can assume the trusted profile. * - * Add a specific identity that can assume the trusted profile. This API will update the trusted profile itself, thus - * calling it repeatedly for the same profile can lead to conflicts responded with HTTP code 409. Make sure to call - * this API only once in a few seconds for the same trusted profile. + * Add a specific identity that can assume the trusted profile. + * + * **Note:** This API will update the trusted profile itself, thus calling it repeatedly for the same profile can + * lead to conflicts responded with HTTP code 409. Make sure to call this API only once in a few seconds for the + * same trusted profile. * * @param setProfileIdentityOptions the {@link SetProfileIdentityOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ProfileIdentityResponse} @@ -1321,10 +1500,14 @@ public ServiceCall getProfileIdentity(GetProfileIdentit } /** - * Delete the identity that can assume the trusted profile. This API will update the trusted profile itself, thus calling it repeatedly for the same profile can lead to conflicts responded with HTTP code 409. Make sure to call this API only once in a few seconds for the same trusted profile. + * Delete the identity that can assume the trusted profile. * * Delete the identity that can assume the trusted profile. * + * **Note:** This API will update the trusted profile itself, thus calling it repeatedly for the same profile can + * lead to conflicts responded with HTTP code 409. Make sure to call this API only once in a few seconds for the + * same trusted profile. + * * @param deleteProfileIdentityOptions the {@link DeleteProfileIdentityOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ @@ -1345,28 +1528,85 @@ public ServiceCall deleteProfileIdentity(DeleteProfileIdentityOptions dele } /** - * Get account configurations. + * Trigger activity report for the account. * - * Returns the details of an account's configuration. + * Trigger activity report for the account by specifying the account ID. It can take a few minutes to generate the + * report for retrieval. * - * @param getAccountSettingsOptions the {@link GetAccountSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsResponse} + * @param createReportOptions the {@link CreateReportOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ReportReference} */ - public ServiceCall getAccountSettings(GetAccountSettingsOptions getAccountSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountSettingsOptions, - "getAccountSettingsOptions cannot be null"); + public ServiceCall createReport(CreateReportOptions createReportOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createReportOptions, + "createReportOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getAccountSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/identity", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAccountSettings"); + pathParamsMap.put("account_id", createReportOptions.accountId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/activity/accounts/{account_id}/report", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createReport"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getAccountSettingsOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getAccountSettingsOptions.includeHistory())); + if (createReportOptions.type() != null) { + builder.query("type", String.valueOf(createReportOptions.type())); } - ResponseConverter responseConverter = + if (createReportOptions.duration() != null) { + builder.query("duration", String.valueOf(createReportOptions.duration())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get activity report for the account. + * + * Get activity report for the account by specifying the account ID and the reference that is generated by triggering + * the report. Reports older than a day are deleted when generating a new report. + * + * @param getReportOptions the {@link GetReportOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Report} + */ + public ServiceCall getReport(GetReportOptions getReportOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getReportOptions, + "getReportOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getReportOptions.accountId()); + pathParamsMap.put("reference", getReportOptions.reference()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/activity/accounts/{account_id}/report/{reference}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getReport"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get account configurations. + * + * Returns the details of an account's configuration. + * + * @param getAccountSettingsOptions the {@link GetAccountSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsResponse} + */ + public ServiceCall getAccountSettings(GetAccountSettingsOptions getAccountSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountSettingsOptions, + "getAccountSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getAccountSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/identity", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAccountSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getAccountSettingsOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getAccountSettingsOptions.includeHistory())); + } + ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } @@ -1429,6 +1669,36 @@ public ServiceCall updateAccountSettings(UpdateAccountS return createServiceCall(builder.build(), responseConverter); } + /** + * Get effective account settings configuration. + * + * Returns effective account settings for given account ID. + * + * @param getEffectiveAccountSettingsOptions the {@link GetEffectiveAccountSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link EffectiveAccountSettingsResponse} + */ + public ServiceCall getEffectiveAccountSettings(GetEffectiveAccountSettingsOptions getEffectiveAccountSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getEffectiveAccountSettingsOptions, + "getEffectiveAccountSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getEffectiveAccountSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/effective_settings/identity", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getEffectiveAccountSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getEffectiveAccountSettingsOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getEffectiveAccountSettingsOptions.includeHistory())); + } + if (getEffectiveAccountSettingsOptions.resolveUserMfa() != null) { + builder.query("resolve_user_mfa", String.valueOf(getEffectiveAccountSettingsOptions.resolveUserMfa())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + /** * Get MFA enrollment status for a single user in the account. * @@ -1509,320 +1779,330 @@ public ServiceCall getMfaReport(GetMfaReportOptions g } /** - * List assignments. + * Update Identity Preference on scope account. * - * List account settings assignments. + * Update one Identity Preference on scope `account`. * - * @param listAccountSettingsAssignmentsOptions the {@link ListAccountSettingsAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} + * The following preferences are storing values for identities inside an account, i.e. for each account that an + * identity is member of, the value stored might be different. This means, **users** who might be member of multiple + * accounts can have multiple preferences, one per account. Identities like **Service Ids** or **Trusted Profiles** + * can only exist in one account, therefore they can only have one preference inside their related account. + * + * ### Preferences + * + * - **console/landing_page** + * + * service: `console` + * + * preference_id: `landing_page` + * + * supported identity types: `Trusted Profile` + * + * type: `string` + * + * validation: valid path for the IBM Cloud Console (without host part), e.g. `/billing` or `/iam` + * + * - **console/global_left_navigation** + * + * service: `console` + * + * preference_id: `global_left_navigation` + * + * supported identity types: `Trusted Profile` + * + * type: `list of strings` + * + * validation: each entry in the list of strings must match the identifier of one navigation entry in the console; + * these identifiers are defined and interpreted by the IBM Cloud Console; currently the following entries are + * supported: + * + * `slash,projects,rex,containers,databases,is,logmet,automation,complianceAndSecurity,apis,cp4d,partner-center,sap,satellite,vmWare,watsonx` + * + * ### Authorization + * + * To call this method for the identity type `Trusted Profile`, you must be assigned one or more IAM access roles that + * include the following action on the target resource `account` and resource type `preferences`: + * + * - iam-identity.preferences.update + * + * By default, the `Administrator` role on service `iam-identity` contains this action. + * + * @param updatePreferenceOnScopeAccountOptions the {@link UpdatePreferenceOnScopeAccountOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link IdentityPreferenceResponse} */ - public ServiceCall listAccountSettingsAssignments(ListAccountSettingsAssignmentsOptions listAccountSettingsAssignmentsOptions) { - if (listAccountSettingsAssignmentsOptions == null) { - listAccountSettingsAssignmentsOptions = new ListAccountSettingsAssignmentsOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listAccountSettingsAssignments"); + public ServiceCall updatePreferenceOnScopeAccount(UpdatePreferenceOnScopeAccountOptions updatePreferenceOnScopeAccountOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePreferenceOnScopeAccountOptions, + "updatePreferenceOnScopeAccountOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updatePreferenceOnScopeAccountOptions.accountId()); + pathParamsMap.put("iam_id", updatePreferenceOnScopeAccountOptions.iamId()); + pathParamsMap.put("service", updatePreferenceOnScopeAccountOptions.service()); + pathParamsMap.put("preference_id", updatePreferenceOnScopeAccountOptions.preferenceId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}/{service}/{preference_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updatePreferenceOnScopeAccount"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listAccountSettingsAssignmentsOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listAccountSettingsAssignmentsOptions.accountId())); - } - if (listAccountSettingsAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listAccountSettingsAssignmentsOptions.templateId())); - } - if (listAccountSettingsAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listAccountSettingsAssignmentsOptions.templateVersion())); - } - if (listAccountSettingsAssignmentsOptions.target() != null) { - builder.query("target", String.valueOf(listAccountSettingsAssignmentsOptions.target())); - } - if (listAccountSettingsAssignmentsOptions.targetType() != null) { - builder.query("target_type", String.valueOf(listAccountSettingsAssignmentsOptions.targetType())); - } - if (listAccountSettingsAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listAccountSettingsAssignmentsOptions.limit())); - } - if (listAccountSettingsAssignmentsOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listAccountSettingsAssignmentsOptions.pagetoken())); - } - if (listAccountSettingsAssignmentsOptions.sort() != null) { - builder.query("sort", String.valueOf(listAccountSettingsAssignmentsOptions.sort())); - } - if (listAccountSettingsAssignmentsOptions.order() != null) { - builder.query("order", String.valueOf(listAccountSettingsAssignmentsOptions.order())); - } - if (listAccountSettingsAssignmentsOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listAccountSettingsAssignmentsOptions.includeHistory())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("value_string", updatePreferenceOnScopeAccountOptions.valueString()); + if (updatePreferenceOnScopeAccountOptions.valueListOfStrings() != null) { + contentJson.add("value_list_of_strings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updatePreferenceOnScopeAccountOptions.valueListOfStrings())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List assignments. + * Delete Identity Preference on scope account. * - * List account settings assignments. + * Delete one Identity Preference on scope `account`. For details about the preferences supported and how the method + * request is authorized, refer to the description of operation + * `Update Identity Preference on scope account`. * - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} + * @param deletePreferencesOnScopeAccountOptions the {@link DeletePreferencesOnScopeAccountOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result */ - public ServiceCall listAccountSettingsAssignments() { - return listAccountSettingsAssignments(null); + public ServiceCall deletePreferencesOnScopeAccount(DeletePreferencesOnScopeAccountOptions deletePreferencesOnScopeAccountOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePreferencesOnScopeAccountOptions, + "deletePreferencesOnScopeAccountOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", deletePreferencesOnScopeAccountOptions.accountId()); + pathParamsMap.put("iam_id", deletePreferencesOnScopeAccountOptions.iamId()); + pathParamsMap.put("service", deletePreferencesOnScopeAccountOptions.service()); + pathParamsMap.put("preference_id", deletePreferencesOnScopeAccountOptions.preferenceId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}/{service}/{preference_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deletePreferencesOnScopeAccount"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); } /** - * Create assignment. + * Get Identity Preference on scope account. * - * Create an assigment for an account settings template. + * Get one Identity Preference on scope `account`. For details about the preferences supported, refer to the + * description of operation `Update Identity Preference on scope account`. * - * @param createAccountSettingsAssignmentOptions the {@link CreateAccountSettingsAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} + * ### Authorization + * + * To call this method for the identity type `Trusted Profile`, one of the following conditions must be true: + * + * - the Authorization token represents the trusted profile which is addressed by this request + * + * - you must be assigned one or more IAM access roles that include the following action on the target resource + * `account` and resource type `preferences`: + * + * - iam-identity.preferences.update + * + * By default, the `Administrator` role on service `iam-identity` contains this action. + * + * - Services inside the IBM Cloud Console can call this method. + * + * @param getPreferencesOnScopeAccountOptions the {@link GetPreferencesOnScopeAccountOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link IdentityPreferenceResponse} */ - public ServiceCall createAccountSettingsAssignment(CreateAccountSettingsAssignmentOptions createAccountSettingsAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createAccountSettingsAssignmentOptions, - "createAccountSettingsAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createAccountSettingsAssignment"); + public ServiceCall getPreferencesOnScopeAccount(GetPreferencesOnScopeAccountOptions getPreferencesOnScopeAccountOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPreferencesOnScopeAccountOptions, + "getPreferencesOnScopeAccountOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getPreferencesOnScopeAccountOptions.accountId()); + pathParamsMap.put("iam_id", getPreferencesOnScopeAccountOptions.iamId()); + pathParamsMap.put("service", getPreferencesOnScopeAccountOptions.service()); + pathParamsMap.put("preference_id", getPreferencesOnScopeAccountOptions.preferenceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}/{service}/{preference_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getPreferencesOnScopeAccount"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_id", createAccountSettingsAssignmentOptions.templateId()); - contentJson.addProperty("template_version", createAccountSettingsAssignmentOptions.templateVersion()); - contentJson.addProperty("target_type", createAccountSettingsAssignmentOptions.targetType()); - contentJson.addProperty("target", createAccountSettingsAssignmentOptions.target()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get assignment. + * Get all Identity Preferences on scope account. * - * Get an assigment for an account settings template. + * Get all Identity Preferences for one account / identity combination. For details about the preferences supported + * and how the method request is authorized, refer to the description of operation + * `Get Identity Preference on scope account`. * - * @param getAccountSettingsAssignmentOptions the {@link GetAccountSettingsAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} + * If you are not allowed to read a preference, the call will not fail. Instead, this preference is/ these preferences + * are not returned in the list call. + * + * @param getAllPreferencesOnScopeAccountOptions the {@link GetAllPreferencesOnScopeAccountOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link IdentityPreferencesResponse} */ - public ServiceCall getAccountSettingsAssignment(GetAccountSettingsAssignmentOptions getAccountSettingsAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountSettingsAssignmentOptions, - "getAccountSettingsAssignmentOptions cannot be null"); + public ServiceCall getAllPreferencesOnScopeAccount(GetAllPreferencesOnScopeAccountOptions getAllPreferencesOnScopeAccountOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAllPreferencesOnScopeAccountOptions, + "getAllPreferencesOnScopeAccountOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getAccountSettingsAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAccountSettingsAssignment"); + pathParamsMap.put("account_id", getAllPreferencesOnScopeAccountOptions.accountId()); + pathParamsMap.put("iam_id", getAllPreferencesOnScopeAccountOptions.iamId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAllPreferencesOnScopeAccount"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getAccountSettingsAssignmentOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getAccountSettingsAssignmentOptions.includeHistory())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete assignment. + * List trusted profile templates. * - * Delete an account settings template assignment. This removes any IAM resources created by this assignment in child - * accounts. - * - * @param deleteAccountSettingsAssignmentOptions the {@link DeleteAccountSettingsAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ExceptionResponse} - */ - public ServiceCall deleteAccountSettingsAssignment(DeleteAccountSettingsAssignmentOptions deleteAccountSettingsAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccountSettingsAssignmentOptions, - "deleteAccountSettingsAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteAccountSettingsAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAccountSettingsAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update assignment. - * - * Update an account settings assignment. Call this method to retry failed assignments or migrate the settings in - * child accounts to a new version. - * - * @param updateAccountSettingsAssignmentOptions the {@link UpdateAccountSettingsAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} - */ - public ServiceCall updateAccountSettingsAssignment(UpdateAccountSettingsAssignmentOptions updateAccountSettingsAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccountSettingsAssignmentOptions, - "updateAccountSettingsAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateAccountSettingsAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateAccountSettingsAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateAccountSettingsAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateAccountSettingsAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List account settings templates. - * - * List account settings templates in an enterprise account. + * List the trusted profile templates in an enterprise account. * - * @param listAccountSettingsTemplatesOptions the {@link ListAccountSettingsTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateList} + * @param listProfileTemplatesOptions the {@link ListProfileTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateList} */ - public ServiceCall listAccountSettingsTemplates(ListAccountSettingsTemplatesOptions listAccountSettingsTemplatesOptions) { - if (listAccountSettingsTemplatesOptions == null) { - listAccountSettingsTemplatesOptions = new ListAccountSettingsTemplatesOptions.Builder().build(); + public ServiceCall listProfileTemplates(ListProfileTemplatesOptions listProfileTemplatesOptions) { + if (listProfileTemplatesOptions == null) { + listProfileTemplatesOptions = new ListProfileTemplatesOptions.Builder().build(); } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listAccountSettingsTemplates"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listProfileTemplates"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listAccountSettingsTemplatesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listAccountSettingsTemplatesOptions.accountId())); + if (listProfileTemplatesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listProfileTemplatesOptions.accountId())); } - if (listAccountSettingsTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listAccountSettingsTemplatesOptions.limit())); + if (listProfileTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listProfileTemplatesOptions.limit())); } - if (listAccountSettingsTemplatesOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listAccountSettingsTemplatesOptions.pagetoken())); + if (listProfileTemplatesOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listProfileTemplatesOptions.pagetoken())); } - if (listAccountSettingsTemplatesOptions.sort() != null) { - builder.query("sort", String.valueOf(listAccountSettingsTemplatesOptions.sort())); + if (listProfileTemplatesOptions.sort() != null) { + builder.query("sort", String.valueOf(listProfileTemplatesOptions.sort())); } - if (listAccountSettingsTemplatesOptions.order() != null) { - builder.query("order", String.valueOf(listAccountSettingsTemplatesOptions.order())); + if (listProfileTemplatesOptions.order() != null) { + builder.query("order", String.valueOf(listProfileTemplatesOptions.order())); } - if (listAccountSettingsTemplatesOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listAccountSettingsTemplatesOptions.includeHistory())); + if (listProfileTemplatesOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listProfileTemplatesOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List account settings templates. + * List trusted profile templates. * - * List account settings templates in an enterprise account. + * List the trusted profile templates in an enterprise account. * - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateList} + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateList} */ - public ServiceCall listAccountSettingsTemplates() { - return listAccountSettingsTemplates(null); + public ServiceCall listProfileTemplates() { + return listProfileTemplates(null); } /** - * Create an account settings template. + * Create a trusted profile template. * - * Create a new account settings template in an enterprise account. + * Create a new trusted profile template in an enterprise account. * - * @param createAccountSettingsTemplateOptions the {@link CreateAccountSettingsTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} + * @param createProfileTemplateOptions the {@link CreateProfileTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} */ - public ServiceCall createAccountSettingsTemplate(CreateAccountSettingsTemplateOptions createAccountSettingsTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createAccountSettingsTemplateOptions, - "createAccountSettingsTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createAccountSettingsTemplate"); + public ServiceCall createProfileTemplate(CreateProfileTemplateOptions createProfileTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileTemplateOptions, + "createProfileTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createProfileTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createAccountSettingsTemplateOptions.accountId() != null) { - contentJson.addProperty("account_id", createAccountSettingsTemplateOptions.accountId()); + if (createProfileTemplateOptions.accountId() != null) { + contentJson.addProperty("account_id", createProfileTemplateOptions.accountId()); } - if (createAccountSettingsTemplateOptions.name() != null) { - contentJson.addProperty("name", createAccountSettingsTemplateOptions.name()); + if (createProfileTemplateOptions.name() != null) { + contentJson.addProperty("name", createProfileTemplateOptions.name()); } - if (createAccountSettingsTemplateOptions.description() != null) { - contentJson.addProperty("description", createAccountSettingsTemplateOptions.description()); + if (createProfileTemplateOptions.description() != null) { + contentJson.addProperty("description", createProfileTemplateOptions.description()); } - if (createAccountSettingsTemplateOptions.accountSettings() != null) { - contentJson.add("account_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAccountSettingsTemplateOptions.accountSettings())); + if (createProfileTemplateOptions.profile() != null) { + contentJson.add("profile", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.profile())); + } + if (createProfileTemplateOptions.policyTemplateReferences() != null) { + contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.policyTemplateReferences())); + } + if (createProfileTemplateOptions.actionControls() != null) { + contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.actionControls())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create an account settings template. + * Create a trusted profile template. * - * Create a new account settings template in an enterprise account. + * Create a new trusted profile template in an enterprise account. * - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} */ - public ServiceCall createAccountSettingsTemplate() { - return createAccountSettingsTemplate(null); + public ServiceCall createProfileTemplate() { + return createProfileTemplate(null); } /** - * Get latest version of an account settings template. + * Get latest version of a trusted profile template. * - * Get the latest version of a specific account settings template in an enterprise account. + * Get the latest version of a trusted profile template in an enterprise account. * - * @param getLatestAccountSettingsTemplateVersionOptions the {@link GetLatestAccountSettingsTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} + * @param getLatestProfileTemplateVersionOptions the {@link GetLatestProfileTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} */ - public ServiceCall getLatestAccountSettingsTemplateVersion(GetLatestAccountSettingsTemplateVersionOptions getLatestAccountSettingsTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getLatestAccountSettingsTemplateVersionOptions, - "getLatestAccountSettingsTemplateVersionOptions cannot be null"); + public ServiceCall getLatestProfileTemplateVersion(GetLatestProfileTemplateVersionOptions getLatestProfileTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getLatestProfileTemplateVersionOptions, + "getLatestProfileTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", getLatestAccountSettingsTemplateVersionOptions.templateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getLatestAccountSettingsTemplateVersion"); + pathParamsMap.put("template_id", getLatestProfileTemplateVersionOptions.templateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getLatestProfileTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getLatestAccountSettingsTemplateVersionOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getLatestAccountSettingsTemplateVersionOptions.includeHistory())); + if (getLatestProfileTemplateVersionOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getLatestProfileTemplateVersionOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete all versions of an account settings template. + * Delete all versions of a trusted profile template. * - * Delete all versions of an account settings template in an enterprise account. If any version is assigned to child + * Delete all versions of a trusted profile template in an enterprise account. If any version is assigned to child * accounts, you must first delete the assignment. * - * @param deleteAllVersionsOfAccountSettingsTemplateOptions the {@link DeleteAllVersionsOfAccountSettingsTemplateOptions} containing the options for the call + * @param deleteAllVersionsOfProfileTemplateOptions the {@link DeleteAllVersionsOfProfileTemplateOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteAllVersionsOfAccountSettingsTemplate(DeleteAllVersionsOfAccountSettingsTemplateOptions deleteAllVersionsOfAccountSettingsTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllVersionsOfAccountSettingsTemplateOptions, - "deleteAllVersionsOfAccountSettingsTemplateOptions cannot be null"); + public ServiceCall deleteAllVersionsOfProfileTemplate(DeleteAllVersionsOfProfileTemplateOptions deleteAllVersionsOfProfileTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllVersionsOfProfileTemplateOptions, + "deleteAllVersionsOfProfileTemplateOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", deleteAllVersionsOfAccountSettingsTemplateOptions.templateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAllVersionsOfAccountSettingsTemplate"); + pathParamsMap.put("template_id", deleteAllVersionsOfProfileTemplateOptions.templateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAllVersionsOfProfileTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -1831,166 +2111,179 @@ public ServiceCall deleteAllVersionsOfAccountSettingsTemplate(DeleteAllVer } /** - * List account settings template versions. + * List trusted profile template versions. * - * List the versions of a specific account settings template in an enterprise account. + * List the versions of a trusted profile template in an enterprise account. * - * @param listVersionsOfAccountSettingsTemplateOptions the {@link ListVersionsOfAccountSettingsTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateList} + * @param listVersionsOfProfileTemplateOptions the {@link ListVersionsOfProfileTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateList} */ - public ServiceCall listVersionsOfAccountSettingsTemplate(ListVersionsOfAccountSettingsTemplateOptions listVersionsOfAccountSettingsTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listVersionsOfAccountSettingsTemplateOptions, - "listVersionsOfAccountSettingsTemplateOptions cannot be null"); + public ServiceCall listVersionsOfProfileTemplate(ListVersionsOfProfileTemplateOptions listVersionsOfProfileTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listVersionsOfProfileTemplateOptions, + "listVersionsOfProfileTemplateOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", listVersionsOfAccountSettingsTemplateOptions.templateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listVersionsOfAccountSettingsTemplate"); + pathParamsMap.put("template_id", listVersionsOfProfileTemplateOptions.templateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listVersionsOfProfileTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listVersionsOfAccountSettingsTemplateOptions.limit() != null) { - builder.query("limit", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.limit())); + if (listVersionsOfProfileTemplateOptions.limit() != null) { + builder.query("limit", String.valueOf(listVersionsOfProfileTemplateOptions.limit())); } - if (listVersionsOfAccountSettingsTemplateOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.pagetoken())); + if (listVersionsOfProfileTemplateOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listVersionsOfProfileTemplateOptions.pagetoken())); } - if (listVersionsOfAccountSettingsTemplateOptions.sort() != null) { - builder.query("sort", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.sort())); + if (listVersionsOfProfileTemplateOptions.sort() != null) { + builder.query("sort", String.valueOf(listVersionsOfProfileTemplateOptions.sort())); } - if (listVersionsOfAccountSettingsTemplateOptions.order() != null) { - builder.query("order", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.order())); + if (listVersionsOfProfileTemplateOptions.order() != null) { + builder.query("order", String.valueOf(listVersionsOfProfileTemplateOptions.order())); } - if (listVersionsOfAccountSettingsTemplateOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.includeHistory())); + if (listVersionsOfProfileTemplateOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listVersionsOfProfileTemplateOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create a new version of an account settings template. + * Create new version of a trusted profile template. * - * Create a new version of an account settings template in an Enterprise Account. + * Create a new version of a trusted profile template in an enterprise account. * - * @param createAccountSettingsTemplateVersionOptions the {@link CreateAccountSettingsTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} + * @param createProfileTemplateVersionOptions the {@link CreateProfileTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} */ - public ServiceCall createAccountSettingsTemplateVersion(CreateAccountSettingsTemplateVersionOptions createAccountSettingsTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createAccountSettingsTemplateVersionOptions, - "createAccountSettingsTemplateVersionOptions cannot be null"); + public ServiceCall createProfileTemplateVersion(CreateProfileTemplateVersionOptions createProfileTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileTemplateVersionOptions, + "createProfileTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", createAccountSettingsTemplateVersionOptions.templateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createAccountSettingsTemplateVersion"); + pathParamsMap.put("template_id", createProfileTemplateVersionOptions.templateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createProfileTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createAccountSettingsTemplateVersionOptions.accountId() != null) { - contentJson.addProperty("account_id", createAccountSettingsTemplateVersionOptions.accountId()); + if (createProfileTemplateVersionOptions.accountId() != null) { + contentJson.addProperty("account_id", createProfileTemplateVersionOptions.accountId()); } - if (createAccountSettingsTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createAccountSettingsTemplateVersionOptions.name()); + if (createProfileTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createProfileTemplateVersionOptions.name()); } - if (createAccountSettingsTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createAccountSettingsTemplateVersionOptions.description()); + if (createProfileTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createProfileTemplateVersionOptions.description()); } - if (createAccountSettingsTemplateVersionOptions.accountSettings() != null) { - contentJson.add("account_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAccountSettingsTemplateVersionOptions.accountSettings())); + if (createProfileTemplateVersionOptions.profile() != null) { + contentJson.add("profile", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.profile())); + } + if (createProfileTemplateVersionOptions.policyTemplateReferences() != null) { + contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.policyTemplateReferences())); + } + if (createProfileTemplateVersionOptions.actionControls() != null) { + contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.actionControls())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get version of an account settings template. + * Get version of trusted profile template. * - * Get a specific version of an account settings template in an Enterprise Account. + * Get a specific version of a trusted profile template in an enterprise account. * - * @param getAccountSettingsTemplateVersionOptions the {@link GetAccountSettingsTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} + * @param getProfileTemplateVersionOptions the {@link GetProfileTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} */ - public ServiceCall getAccountSettingsTemplateVersion(GetAccountSettingsTemplateVersionOptions getAccountSettingsTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountSettingsTemplateVersionOptions, - "getAccountSettingsTemplateVersionOptions cannot be null"); + public ServiceCall getProfileTemplateVersion(GetProfileTemplateVersionOptions getProfileTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getProfileTemplateVersionOptions, + "getProfileTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", getAccountSettingsTemplateVersionOptions.templateId()); - pathParamsMap.put("version", getAccountSettingsTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAccountSettingsTemplateVersion"); + pathParamsMap.put("template_id", getProfileTemplateVersionOptions.templateId()); + pathParamsMap.put("version", getProfileTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getProfileTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getAccountSettingsTemplateVersionOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getAccountSettingsTemplateVersionOptions.includeHistory())); + if (getProfileTemplateVersionOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getProfileTemplateVersionOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update version of an account settings template. + * Update version of trusted profile template. * - * Update a specific version of an account settings template in an Enterprise Account. + * Update a specific version of a trusted profile template in an enterprise account. * - * @param updateAccountSettingsTemplateVersionOptions the {@link UpdateAccountSettingsTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} + * @param updateProfileTemplateVersionOptions the {@link UpdateProfileTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} */ - public ServiceCall updateAccountSettingsTemplateVersion(UpdateAccountSettingsTemplateVersionOptions updateAccountSettingsTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccountSettingsTemplateVersionOptions, - "updateAccountSettingsTemplateVersionOptions cannot be null"); + public ServiceCall updateProfileTemplateVersion(UpdateProfileTemplateVersionOptions updateProfileTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateProfileTemplateVersionOptions, + "updateProfileTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", updateAccountSettingsTemplateVersionOptions.templateId()); - pathParamsMap.put("version", updateAccountSettingsTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateAccountSettingsTemplateVersion"); + pathParamsMap.put("template_id", updateProfileTemplateVersionOptions.templateId()); + pathParamsMap.put("version", updateProfileTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateProfileTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - builder.header("If-Match", updateAccountSettingsTemplateVersionOptions.ifMatch()); + builder.header("If-Match", updateProfileTemplateVersionOptions.ifMatch()); final JsonObject contentJson = new JsonObject(); - if (updateAccountSettingsTemplateVersionOptions.accountId() != null) { - contentJson.addProperty("account_id", updateAccountSettingsTemplateVersionOptions.accountId()); + if (updateProfileTemplateVersionOptions.accountId() != null) { + contentJson.addProperty("account_id", updateProfileTemplateVersionOptions.accountId()); } - if (updateAccountSettingsTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", updateAccountSettingsTemplateVersionOptions.name()); + if (updateProfileTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", updateProfileTemplateVersionOptions.name()); } - if (updateAccountSettingsTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", updateAccountSettingsTemplateVersionOptions.description()); + if (updateProfileTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", updateProfileTemplateVersionOptions.description()); } - if (updateAccountSettingsTemplateVersionOptions.accountSettings() != null) { - contentJson.add("account_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccountSettingsTemplateVersionOptions.accountSettings())); + if (updateProfileTemplateVersionOptions.profile() != null) { + contentJson.add("profile", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.profile())); + } + if (updateProfileTemplateVersionOptions.policyTemplateReferences() != null) { + contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.policyTemplateReferences())); + } + if (updateProfileTemplateVersionOptions.actionControls() != null) { + contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.actionControls())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete version of an account settings template. + * Delete version of trusted profile template. * - * Delete a specific version of an account settings template in an Enterprise Account. + * Delete a specific version of a trusted profile template in an enterprise account. If the version is assigned to + * child accounts, you must first delete the assignment. * - * @param deleteAccountSettingsTemplateVersionOptions the {@link DeleteAccountSettingsTemplateVersionOptions} containing the options for the call + * @param deleteProfileTemplateVersionOptions the {@link DeleteProfileTemplateVersionOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteAccountSettingsTemplateVersion(DeleteAccountSettingsTemplateVersionOptions deleteAccountSettingsTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccountSettingsTemplateVersionOptions, - "deleteAccountSettingsTemplateVersionOptions cannot be null"); + public ServiceCall deleteProfileTemplateVersion(DeleteProfileTemplateVersionOptions deleteProfileTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProfileTemplateVersionOptions, + "deleteProfileTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", deleteAccountSettingsTemplateVersionOptions.templateId()); - pathParamsMap.put("version", deleteAccountSettingsTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAccountSettingsTemplateVersion"); + pathParamsMap.put("template_id", deleteProfileTemplateVersionOptions.templateId()); + pathParamsMap.put("version", deleteProfileTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteProfileTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -2001,20 +2294,20 @@ public ServiceCall deleteAccountSettingsTemplateVersion(DeleteAccountSetti /** * Commit a template version. * - * Commit a specific version of an account settings template in an Enterprise Account. A Template must be committed - * before being assigned, and once committed, can no longer be modified. + * Commit a specific version of a trusted profile template in an enterprise account. You must commit a template before + * you can assign it to child accounts. Once a template is committed, you can no longer modify the template. * - * @param commitAccountSettingsTemplateOptions the {@link CommitAccountSettingsTemplateOptions} containing the options for the call + * @param commitProfileTemplateOptions the {@link CommitProfileTemplateOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall commitAccountSettingsTemplate(CommitAccountSettingsTemplateOptions commitAccountSettingsTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitAccountSettingsTemplateOptions, - "commitAccountSettingsTemplateOptions cannot be null"); + public ServiceCall commitProfileTemplate(CommitProfileTemplateOptions commitProfileTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitProfileTemplateOptions, + "commitProfileTemplateOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", commitAccountSettingsTemplateOptions.templateId()); - pathParamsMap.put("version", commitAccountSettingsTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "commitAccountSettingsTemplate"); + pathParamsMap.put("template_id", commitProfileTemplateOptions.templateId()); + pathParamsMap.put("version", commitProfileTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "commitProfileTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -2023,290 +2316,76 @@ public ServiceCall commitAccountSettingsTemplate(CommitAccountSettingsTemp } /** - * Trigger activity report for the account. + * List assignments. * - * Trigger activity report for the account by specifying the account ID. It can take a few minutes to generate the - * report for retrieval. + * List trusted profile template assignments. * - * @param createReportOptions the {@link CreateReportOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ReportReference} + * @param listTrustedProfileAssignmentsOptions the {@link ListTrustedProfileAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} */ - public ServiceCall createReport(CreateReportOptions createReportOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createReportOptions, - "createReportOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", createReportOptions.accountId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/activity/accounts/{account_id}/report", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createReport"); + public ServiceCall listTrustedProfileAssignments(ListTrustedProfileAssignmentsOptions listTrustedProfileAssignmentsOptions) { + if (listTrustedProfileAssignmentsOptions == null) { + listTrustedProfileAssignmentsOptions = new ListTrustedProfileAssignmentsOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_assignments/")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listTrustedProfileAssignments"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createReportOptions.type() != null) { - builder.query("type", String.valueOf(createReportOptions.type())); + if (listTrustedProfileAssignmentsOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listTrustedProfileAssignmentsOptions.accountId())); } - if (createReportOptions.duration() != null) { - builder.query("duration", String.valueOf(createReportOptions.duration())); + if (listTrustedProfileAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listTrustedProfileAssignmentsOptions.templateId())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + if (listTrustedProfileAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listTrustedProfileAssignmentsOptions.templateVersion())); + } + if (listTrustedProfileAssignmentsOptions.target() != null) { + builder.query("target", String.valueOf(listTrustedProfileAssignmentsOptions.target())); + } + if (listTrustedProfileAssignmentsOptions.targetType() != null) { + builder.query("target_type", String.valueOf(listTrustedProfileAssignmentsOptions.targetType())); + } + if (listTrustedProfileAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listTrustedProfileAssignmentsOptions.limit())); + } + if (listTrustedProfileAssignmentsOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listTrustedProfileAssignmentsOptions.pagetoken())); + } + if (listTrustedProfileAssignmentsOptions.sort() != null) { + builder.query("sort", String.valueOf(listTrustedProfileAssignmentsOptions.sort())); + } + if (listTrustedProfileAssignmentsOptions.order() != null) { + builder.query("order", String.valueOf(listTrustedProfileAssignmentsOptions.order())); + } + if (listTrustedProfileAssignmentsOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listTrustedProfileAssignmentsOptions.includeHistory())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get activity report for the account. + * List assignments. * - * Get activity report for the account by specifying the account ID and the reference that is generated by triggering - * the report. Reports older than a day are deleted when generating a new report. + * List trusted profile template assignments. * - * @param getReportOptions the {@link GetReportOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Report} + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} */ - public ServiceCall getReport(GetReportOptions getReportOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getReportOptions, - "getReportOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getReportOptions.accountId()); - pathParamsMap.put("reference", getReportOptions.reference()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/activity/accounts/{account_id}/report/{reference}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getReport"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); + public ServiceCall listTrustedProfileAssignments() { + return listTrustedProfileAssignments(null); } /** - * Get effective account settings configuration. + * Create assignment. * - * Returns effective account settings for given account ID. + * Create an assigment for a trusted profile template. * - * @param getEffectiveAccountSettingsOptions the {@link GetEffectiveAccountSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link EffectiveAccountSettingsResponse} - */ - public ServiceCall getEffectiveAccountSettings(GetEffectiveAccountSettingsOptions getEffectiveAccountSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getEffectiveAccountSettingsOptions, - "getEffectiveAccountSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getEffectiveAccountSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/effective_settings/identity", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getEffectiveAccountSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getEffectiveAccountSettingsOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getEffectiveAccountSettingsOptions.includeHistory())); - } - if (getEffectiveAccountSettingsOptions.resolveUserMfa() != null) { - builder.query("resolve_user_mfa", String.valueOf(getEffectiveAccountSettingsOptions.resolveUserMfa())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Identity Preference on scope account. - * - * Update one Identity Preference on scope 'account'. supported preferences: - * The following preferences are storing values for identities inside an account, - * i.e. for each account that an identity is member of, the value stored might be different. - * This means, users who might be member of multiple accounts can have multiple preferences, one per account. - * Identities like Service Ids or Trusted Profiles can only exist in one account, - * therefore they can only have one preference inside their related account. - * preference: console/landing_page - * service: console - * preferenceId: landing_page - * supportedIdentityType: Trusted Profiles, Users - * type: string - * validation: valid URL (without host part), e.g. /billing or /iam - * preference: console/global_left_navigation - * service: console - * preferenceId: global_left_navigation - * supportedIdentityType: Trusted Profiles, Users - * type: list of strings - * validation: each entry in the list of strings must match the identifier of one navigation entry in the console. - * - * @param updatePreferenceOnScopeAccountOptions the {@link UpdatePreferenceOnScopeAccountOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link IdentityPreferenceResponse} - */ - public ServiceCall updatePreferenceOnScopeAccount(UpdatePreferenceOnScopeAccountOptions updatePreferenceOnScopeAccountOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePreferenceOnScopeAccountOptions, - "updatePreferenceOnScopeAccountOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updatePreferenceOnScopeAccountOptions.accountId()); - pathParamsMap.put("iam_id", updatePreferenceOnScopeAccountOptions.iamId()); - pathParamsMap.put("service", updatePreferenceOnScopeAccountOptions.service()); - pathParamsMap.put("preference_id", updatePreferenceOnScopeAccountOptions.preferenceId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}/{service}/{preference_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updatePreferenceOnScopeAccount"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("value_string", updatePreferenceOnScopeAccountOptions.valueString()); - if (updatePreferenceOnScopeAccountOptions.valueListOfStrings() != null) { - contentJson.add("value_list_of_strings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updatePreferenceOnScopeAccountOptions.valueListOfStrings())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete Identity Preference on scope account. - * - * Delete one Identity Preference on scope 'account'. - * - * @param deletePreferencesOnScopeAccountOptions the {@link DeletePreferencesOnScopeAccountOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePreferencesOnScopeAccount(DeletePreferencesOnScopeAccountOptions deletePreferencesOnScopeAccountOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePreferencesOnScopeAccountOptions, - "deletePreferencesOnScopeAccountOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", deletePreferencesOnScopeAccountOptions.accountId()); - pathParamsMap.put("iam_id", deletePreferencesOnScopeAccountOptions.iamId()); - pathParamsMap.put("service", deletePreferencesOnScopeAccountOptions.service()); - pathParamsMap.put("preference_id", deletePreferencesOnScopeAccountOptions.preferenceId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}/{service}/{preference_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deletePreferencesOnScopeAccount"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get Identity Preference on scope account. - * - * Get one Identity Preference on scope 'account'. - * - * @param getPreferencesOnScopeAccountOptions the {@link GetPreferencesOnScopeAccountOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link IdentityPreferenceResponse} - */ - public ServiceCall getPreferencesOnScopeAccount(GetPreferencesOnScopeAccountOptions getPreferencesOnScopeAccountOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPreferencesOnScopeAccountOptions, - "getPreferencesOnScopeAccountOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getPreferencesOnScopeAccountOptions.accountId()); - pathParamsMap.put("iam_id", getPreferencesOnScopeAccountOptions.iamId()); - pathParamsMap.put("service", getPreferencesOnScopeAccountOptions.service()); - pathParamsMap.put("preference_id", getPreferencesOnScopeAccountOptions.preferenceId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}/{service}/{preference_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getPreferencesOnScopeAccount"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get all Identity Preferences for one account. - * - * Get all Identity Preferences for one account / user combination. - * - * @param getAllPreferencesOnScopeAccountOptions the {@link GetAllPreferencesOnScopeAccountOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AllIdentityPreferencesResponse} - */ - public ServiceCall getAllPreferencesOnScopeAccount(GetAllPreferencesOnScopeAccountOptions getAllPreferencesOnScopeAccountOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getAllPreferencesOnScopeAccountOptions, - "getAllPreferencesOnScopeAccountOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getAllPreferencesOnScopeAccountOptions.accountId()); - pathParamsMap.put("iam_id", getAllPreferencesOnScopeAccountOptions.iamId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/preferences/accounts/{account_id}/identities/{iam_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAllPreferencesOnScopeAccount"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List assignments. - * - * List trusted profile template assignments. - * - * @param listTrustedProfileAssignmentsOptions the {@link ListTrustedProfileAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} - */ - public ServiceCall listTrustedProfileAssignments(ListTrustedProfileAssignmentsOptions listTrustedProfileAssignmentsOptions) { - if (listTrustedProfileAssignmentsOptions == null) { - listTrustedProfileAssignmentsOptions = new ListTrustedProfileAssignmentsOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_assignments/")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listTrustedProfileAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listTrustedProfileAssignmentsOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listTrustedProfileAssignmentsOptions.accountId())); - } - if (listTrustedProfileAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listTrustedProfileAssignmentsOptions.templateId())); - } - if (listTrustedProfileAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listTrustedProfileAssignmentsOptions.templateVersion())); - } - if (listTrustedProfileAssignmentsOptions.target() != null) { - builder.query("target", String.valueOf(listTrustedProfileAssignmentsOptions.target())); - } - if (listTrustedProfileAssignmentsOptions.targetType() != null) { - builder.query("target_type", String.valueOf(listTrustedProfileAssignmentsOptions.targetType())); - } - if (listTrustedProfileAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listTrustedProfileAssignmentsOptions.limit())); - } - if (listTrustedProfileAssignmentsOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listTrustedProfileAssignmentsOptions.pagetoken())); - } - if (listTrustedProfileAssignmentsOptions.sort() != null) { - builder.query("sort", String.valueOf(listTrustedProfileAssignmentsOptions.sort())); - } - if (listTrustedProfileAssignmentsOptions.order() != null) { - builder.query("order", String.valueOf(listTrustedProfileAssignmentsOptions.order())); - } - if (listTrustedProfileAssignmentsOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listTrustedProfileAssignmentsOptions.includeHistory())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List assignments. - * - * List trusted profile template assignments. - * - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} - */ - public ServiceCall listTrustedProfileAssignments() { - return listTrustedProfileAssignments(null); - } - - /** - * Create assignment. - * - * Create an assigment for a trusted profile template. - * - * @param createTrustedProfileAssignmentOptions the {@link CreateTrustedProfileAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} + * @param createTrustedProfileAssignmentOptions the {@link CreateTrustedProfileAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} */ public ServiceCall createTrustedProfileAssignment(CreateTrustedProfileAssignmentOptions createTrustedProfileAssignmentOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(createTrustedProfileAssignmentOptions, @@ -2409,153 +2488,147 @@ public ServiceCall updateTrustedProfileAssignment(Up } /** - * List trusted profile templates. + * List account settings templates. * - * List the trusted profile templates in an enterprise account. + * List account settings templates in an enterprise account. * - * @param listProfileTemplatesOptions the {@link ListProfileTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateList} + * @param listAccountSettingsTemplatesOptions the {@link ListAccountSettingsTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateList} */ - public ServiceCall listProfileTemplates(ListProfileTemplatesOptions listProfileTemplatesOptions) { - if (listProfileTemplatesOptions == null) { - listProfileTemplatesOptions = new ListProfileTemplatesOptions.Builder().build(); + public ServiceCall listAccountSettingsTemplates(ListAccountSettingsTemplatesOptions listAccountSettingsTemplatesOptions) { + if (listAccountSettingsTemplatesOptions == null) { + listAccountSettingsTemplatesOptions = new ListAccountSettingsTemplatesOptions.Builder().build(); } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listProfileTemplates"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listAccountSettingsTemplates"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listProfileTemplatesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listProfileTemplatesOptions.accountId())); + if (listAccountSettingsTemplatesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listAccountSettingsTemplatesOptions.accountId())); } - if (listProfileTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listProfileTemplatesOptions.limit())); + if (listAccountSettingsTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listAccountSettingsTemplatesOptions.limit())); } - if (listProfileTemplatesOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listProfileTemplatesOptions.pagetoken())); + if (listAccountSettingsTemplatesOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listAccountSettingsTemplatesOptions.pagetoken())); } - if (listProfileTemplatesOptions.sort() != null) { - builder.query("sort", String.valueOf(listProfileTemplatesOptions.sort())); + if (listAccountSettingsTemplatesOptions.sort() != null) { + builder.query("sort", String.valueOf(listAccountSettingsTemplatesOptions.sort())); } - if (listProfileTemplatesOptions.order() != null) { - builder.query("order", String.valueOf(listProfileTemplatesOptions.order())); + if (listAccountSettingsTemplatesOptions.order() != null) { + builder.query("order", String.valueOf(listAccountSettingsTemplatesOptions.order())); } - if (listProfileTemplatesOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listProfileTemplatesOptions.includeHistory())); + if (listAccountSettingsTemplatesOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listAccountSettingsTemplatesOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List trusted profile templates. + * List account settings templates. * - * List the trusted profile templates in an enterprise account. + * List account settings templates in an enterprise account. * - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateList} + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateList} */ - public ServiceCall listProfileTemplates() { - return listProfileTemplates(null); + public ServiceCall listAccountSettingsTemplates() { + return listAccountSettingsTemplates(null); } /** - * Create a trusted profile template. + * Create an account settings template. * - * Create a new trusted profile template in an enterprise account. + * Create a new account settings template in an enterprise account. * - * @param createProfileTemplateOptions the {@link CreateProfileTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} + * @param createAccountSettingsTemplateOptions the {@link CreateAccountSettingsTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} */ - public ServiceCall createProfileTemplate(CreateProfileTemplateOptions createProfileTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileTemplateOptions, - "createProfileTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createProfileTemplate"); + public ServiceCall createAccountSettingsTemplate(CreateAccountSettingsTemplateOptions createAccountSettingsTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createAccountSettingsTemplateOptions, + "createAccountSettingsTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createAccountSettingsTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createProfileTemplateOptions.accountId() != null) { - contentJson.addProperty("account_id", createProfileTemplateOptions.accountId()); - } - if (createProfileTemplateOptions.name() != null) { - contentJson.addProperty("name", createProfileTemplateOptions.name()); - } - if (createProfileTemplateOptions.description() != null) { - contentJson.addProperty("description", createProfileTemplateOptions.description()); + if (createAccountSettingsTemplateOptions.accountId() != null) { + contentJson.addProperty("account_id", createAccountSettingsTemplateOptions.accountId()); } - if (createProfileTemplateOptions.profile() != null) { - contentJson.add("profile", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.profile())); + if (createAccountSettingsTemplateOptions.name() != null) { + contentJson.addProperty("name", createAccountSettingsTemplateOptions.name()); } - if (createProfileTemplateOptions.policyTemplateReferences() != null) { - contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.policyTemplateReferences())); + if (createAccountSettingsTemplateOptions.description() != null) { + contentJson.addProperty("description", createAccountSettingsTemplateOptions.description()); } - if (createProfileTemplateOptions.actionControls() != null) { - contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.actionControls())); + if (createAccountSettingsTemplateOptions.accountSettings() != null) { + contentJson.add("account_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAccountSettingsTemplateOptions.accountSettings())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create a trusted profile template. + * Create an account settings template. * - * Create a new trusted profile template in an enterprise account. + * Create a new account settings template in an enterprise account. * - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} */ - public ServiceCall createProfileTemplate() { - return createProfileTemplate(null); + public ServiceCall createAccountSettingsTemplate() { + return createAccountSettingsTemplate(null); } /** - * Get latest version of a trusted profile template. + * Get latest version of an account settings template. * - * Get the latest version of a trusted profile template in an enterprise account. + * Get the latest version of a specific account settings template in an enterprise account. * - * @param getLatestProfileTemplateVersionOptions the {@link GetLatestProfileTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} + * @param getLatestAccountSettingsTemplateVersionOptions the {@link GetLatestAccountSettingsTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} */ - public ServiceCall getLatestProfileTemplateVersion(GetLatestProfileTemplateVersionOptions getLatestProfileTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getLatestProfileTemplateVersionOptions, - "getLatestProfileTemplateVersionOptions cannot be null"); + public ServiceCall getLatestAccountSettingsTemplateVersion(GetLatestAccountSettingsTemplateVersionOptions getLatestAccountSettingsTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getLatestAccountSettingsTemplateVersionOptions, + "getLatestAccountSettingsTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", getLatestProfileTemplateVersionOptions.templateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getLatestProfileTemplateVersion"); + pathParamsMap.put("template_id", getLatestAccountSettingsTemplateVersionOptions.templateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getLatestAccountSettingsTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getLatestProfileTemplateVersionOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getLatestProfileTemplateVersionOptions.includeHistory())); + if (getLatestAccountSettingsTemplateVersionOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getLatestAccountSettingsTemplateVersionOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete all versions of a trusted profile template. + * Delete all versions of an account settings template. * - * Delete all versions of a trusted profile template in an enterprise account. If any version is assigned to child + * Delete all versions of an account settings template in an enterprise account. If any version is assigned to child * accounts, you must first delete the assignment. * - * @param deleteAllVersionsOfProfileTemplateOptions the {@link DeleteAllVersionsOfProfileTemplateOptions} containing the options for the call + * @param deleteAllVersionsOfAccountSettingsTemplateOptions the {@link DeleteAllVersionsOfAccountSettingsTemplateOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteAllVersionsOfProfileTemplate(DeleteAllVersionsOfProfileTemplateOptions deleteAllVersionsOfProfileTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllVersionsOfProfileTemplateOptions, - "deleteAllVersionsOfProfileTemplateOptions cannot be null"); + public ServiceCall deleteAllVersionsOfAccountSettingsTemplate(DeleteAllVersionsOfAccountSettingsTemplateOptions deleteAllVersionsOfAccountSettingsTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllVersionsOfAccountSettingsTemplateOptions, + "deleteAllVersionsOfAccountSettingsTemplateOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", deleteAllVersionsOfProfileTemplateOptions.templateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAllVersionsOfProfileTemplate"); + pathParamsMap.put("template_id", deleteAllVersionsOfAccountSettingsTemplateOptions.templateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAllVersionsOfAccountSettingsTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -2564,179 +2637,166 @@ public ServiceCall deleteAllVersionsOfProfileTemplate(DeleteAllVersionsOfP } /** - * List trusted profile template versions. + * List account settings template versions. * - * List the versions of a trusted profile template in an enterprise account. + * List the versions of a specific account settings template in an enterprise account. * - * @param listVersionsOfProfileTemplateOptions the {@link ListVersionsOfProfileTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateList} + * @param listVersionsOfAccountSettingsTemplateOptions the {@link ListVersionsOfAccountSettingsTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateList} */ - public ServiceCall listVersionsOfProfileTemplate(ListVersionsOfProfileTemplateOptions listVersionsOfProfileTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listVersionsOfProfileTemplateOptions, - "listVersionsOfProfileTemplateOptions cannot be null"); + public ServiceCall listVersionsOfAccountSettingsTemplate(ListVersionsOfAccountSettingsTemplateOptions listVersionsOfAccountSettingsTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listVersionsOfAccountSettingsTemplateOptions, + "listVersionsOfAccountSettingsTemplateOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", listVersionsOfProfileTemplateOptions.templateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listVersionsOfProfileTemplate"); + pathParamsMap.put("template_id", listVersionsOfAccountSettingsTemplateOptions.templateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listVersionsOfAccountSettingsTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listVersionsOfProfileTemplateOptions.limit() != null) { - builder.query("limit", String.valueOf(listVersionsOfProfileTemplateOptions.limit())); + if (listVersionsOfAccountSettingsTemplateOptions.limit() != null) { + builder.query("limit", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.limit())); } - if (listVersionsOfProfileTemplateOptions.pagetoken() != null) { - builder.query("pagetoken", String.valueOf(listVersionsOfProfileTemplateOptions.pagetoken())); + if (listVersionsOfAccountSettingsTemplateOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.pagetoken())); } - if (listVersionsOfProfileTemplateOptions.sort() != null) { - builder.query("sort", String.valueOf(listVersionsOfProfileTemplateOptions.sort())); + if (listVersionsOfAccountSettingsTemplateOptions.sort() != null) { + builder.query("sort", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.sort())); } - if (listVersionsOfProfileTemplateOptions.order() != null) { - builder.query("order", String.valueOf(listVersionsOfProfileTemplateOptions.order())); + if (listVersionsOfAccountSettingsTemplateOptions.order() != null) { + builder.query("order", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.order())); } - if (listVersionsOfProfileTemplateOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(listVersionsOfProfileTemplateOptions.includeHistory())); + if (listVersionsOfAccountSettingsTemplateOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listVersionsOfAccountSettingsTemplateOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create new version of a trusted profile template. + * Create a new version of an account settings template. * - * Create a new version of a trusted profile template in an enterprise account. + * Create a new version of an account settings template in an Enterprise Account. * - * @param createProfileTemplateVersionOptions the {@link CreateProfileTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} + * @param createAccountSettingsTemplateVersionOptions the {@link CreateAccountSettingsTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} */ - public ServiceCall createProfileTemplateVersion(CreateProfileTemplateVersionOptions createProfileTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileTemplateVersionOptions, - "createProfileTemplateVersionOptions cannot be null"); + public ServiceCall createAccountSettingsTemplateVersion(CreateAccountSettingsTemplateVersionOptions createAccountSettingsTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createAccountSettingsTemplateVersionOptions, + "createAccountSettingsTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", createProfileTemplateVersionOptions.templateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createProfileTemplateVersion"); + pathParamsMap.put("template_id", createAccountSettingsTemplateVersionOptions.templateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createAccountSettingsTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createProfileTemplateVersionOptions.accountId() != null) { - contentJson.addProperty("account_id", createProfileTemplateVersionOptions.accountId()); - } - if (createProfileTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createProfileTemplateVersionOptions.name()); - } - if (createProfileTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createProfileTemplateVersionOptions.description()); + if (createAccountSettingsTemplateVersionOptions.accountId() != null) { + contentJson.addProperty("account_id", createAccountSettingsTemplateVersionOptions.accountId()); } - if (createProfileTemplateVersionOptions.profile() != null) { - contentJson.add("profile", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.profile())); + if (createAccountSettingsTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createAccountSettingsTemplateVersionOptions.name()); } - if (createProfileTemplateVersionOptions.policyTemplateReferences() != null) { - contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.policyTemplateReferences())); + if (createAccountSettingsTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createAccountSettingsTemplateVersionOptions.description()); } - if (createProfileTemplateVersionOptions.actionControls() != null) { - contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.actionControls())); + if (createAccountSettingsTemplateVersionOptions.accountSettings() != null) { + contentJson.add("account_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAccountSettingsTemplateVersionOptions.accountSettings())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get version of trusted profile template. + * Get version of an account settings template. * - * Get a specific version of a trusted profile template in an enterprise account. + * Get a specific version of an account settings template in an Enterprise Account. * - * @param getProfileTemplateVersionOptions the {@link GetProfileTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} + * @param getAccountSettingsTemplateVersionOptions the {@link GetAccountSettingsTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} */ - public ServiceCall getProfileTemplateVersion(GetProfileTemplateVersionOptions getProfileTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getProfileTemplateVersionOptions, - "getProfileTemplateVersionOptions cannot be null"); + public ServiceCall getAccountSettingsTemplateVersion(GetAccountSettingsTemplateVersionOptions getAccountSettingsTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountSettingsTemplateVersionOptions, + "getAccountSettingsTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", getProfileTemplateVersionOptions.templateId()); - pathParamsMap.put("version", getProfileTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getProfileTemplateVersion"); + pathParamsMap.put("template_id", getAccountSettingsTemplateVersionOptions.templateId()); + pathParamsMap.put("version", getAccountSettingsTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAccountSettingsTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getProfileTemplateVersionOptions.includeHistory() != null) { - builder.query("include_history", String.valueOf(getProfileTemplateVersionOptions.includeHistory())); + if (getAccountSettingsTemplateVersionOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getAccountSettingsTemplateVersionOptions.includeHistory())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update version of trusted profile template. + * Update version of an account settings template. * - * Update a specific version of a trusted profile template in an enterprise account. + * Update a specific version of an account settings template in an Enterprise Account. * - * @param updateProfileTemplateVersionOptions the {@link UpdateProfileTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TrustedProfileTemplateResponse} + * @param updateAccountSettingsTemplateVersionOptions the {@link UpdateAccountSettingsTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsTemplateResponse} */ - public ServiceCall updateProfileTemplateVersion(UpdateProfileTemplateVersionOptions updateProfileTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateProfileTemplateVersionOptions, - "updateProfileTemplateVersionOptions cannot be null"); + public ServiceCall updateAccountSettingsTemplateVersion(UpdateAccountSettingsTemplateVersionOptions updateAccountSettingsTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccountSettingsTemplateVersionOptions, + "updateAccountSettingsTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", updateProfileTemplateVersionOptions.templateId()); - pathParamsMap.put("version", updateProfileTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateProfileTemplateVersion"); + pathParamsMap.put("template_id", updateAccountSettingsTemplateVersionOptions.templateId()); + pathParamsMap.put("version", updateAccountSettingsTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateAccountSettingsTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - builder.header("If-Match", updateProfileTemplateVersionOptions.ifMatch()); + builder.header("If-Match", updateAccountSettingsTemplateVersionOptions.ifMatch()); final JsonObject contentJson = new JsonObject(); - if (updateProfileTemplateVersionOptions.accountId() != null) { - contentJson.addProperty("account_id", updateProfileTemplateVersionOptions.accountId()); - } - if (updateProfileTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", updateProfileTemplateVersionOptions.name()); - } - if (updateProfileTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", updateProfileTemplateVersionOptions.description()); + if (updateAccountSettingsTemplateVersionOptions.accountId() != null) { + contentJson.addProperty("account_id", updateAccountSettingsTemplateVersionOptions.accountId()); } - if (updateProfileTemplateVersionOptions.profile() != null) { - contentJson.add("profile", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.profile())); + if (updateAccountSettingsTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", updateAccountSettingsTemplateVersionOptions.name()); } - if (updateProfileTemplateVersionOptions.policyTemplateReferences() != null) { - contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.policyTemplateReferences())); + if (updateAccountSettingsTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", updateAccountSettingsTemplateVersionOptions.description()); } - if (updateProfileTemplateVersionOptions.actionControls() != null) { - contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.actionControls())); + if (updateAccountSettingsTemplateVersionOptions.accountSettings() != null) { + contentJson.add("account_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccountSettingsTemplateVersionOptions.accountSettings())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete version of trusted profile template. + * Delete version of an account settings template. * - * Delete a specific version of a trusted profile template in an enterprise account. If the version is assigned to - * child accounts, you must first delete the assignment. + * Delete a specific version of an account settings template in an Enterprise Account. * - * @param deleteProfileTemplateVersionOptions the {@link DeleteProfileTemplateVersionOptions} containing the options for the call + * @param deleteAccountSettingsTemplateVersionOptions the {@link DeleteAccountSettingsTemplateVersionOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteProfileTemplateVersion(DeleteProfileTemplateVersionOptions deleteProfileTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProfileTemplateVersionOptions, - "deleteProfileTemplateVersionOptions cannot be null"); + public ServiceCall deleteAccountSettingsTemplateVersion(DeleteAccountSettingsTemplateVersionOptions deleteAccountSettingsTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccountSettingsTemplateVersionOptions, + "deleteAccountSettingsTemplateVersionOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", deleteProfileTemplateVersionOptions.templateId()); - pathParamsMap.put("version", deleteProfileTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteProfileTemplateVersion"); + pathParamsMap.put("template_id", deleteAccountSettingsTemplateVersionOptions.templateId()); + pathParamsMap.put("version", deleteAccountSettingsTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAccountSettingsTemplateVersion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -2747,20 +2807,20 @@ public ServiceCall deleteProfileTemplateVersion(DeleteProfileTemplateVersi /** * Commit a template version. * - * Commit a specific version of a trusted profile template in an enterprise account. You must commit a template before - * you can assign it to child accounts. Once a template is committed, you can no longer modify the template. + * Commit a specific version of an account settings template in an Enterprise Account. A Template must be committed + * before being assigned, and once committed, can no longer be modified. * - * @param commitProfileTemplateOptions the {@link CommitProfileTemplateOptions} containing the options for the call + * @param commitAccountSettingsTemplateOptions the {@link CommitAccountSettingsTemplateOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall commitProfileTemplate(CommitProfileTemplateOptions commitProfileTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitProfileTemplateOptions, - "commitProfileTemplateOptions cannot be null"); + public ServiceCall commitAccountSettingsTemplate(CommitAccountSettingsTemplateOptions commitAccountSettingsTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitAccountSettingsTemplateOptions, + "commitAccountSettingsTemplateOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("template_id", commitProfileTemplateOptions.templateId()); - pathParamsMap.put("version", commitProfileTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/profile_templates/{template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "commitProfileTemplate"); + pathParamsMap.put("template_id", commitAccountSettingsTemplateOptions.templateId()); + pathParamsMap.put("version", commitAccountSettingsTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_templates/{template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "commitAccountSettingsTemplate"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -2768,4 +2828,177 @@ public ServiceCall commitProfileTemplate(CommitProfileTemplateOptions comm return createServiceCall(builder.build(), responseConverter); } + /** + * List assignments. + * + * List account settings assignments. + * + * @param listAccountSettingsAssignmentsOptions the {@link ListAccountSettingsAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} + */ + public ServiceCall listAccountSettingsAssignments(ListAccountSettingsAssignmentsOptions listAccountSettingsAssignmentsOptions) { + if (listAccountSettingsAssignmentsOptions == null) { + listAccountSettingsAssignmentsOptions = new ListAccountSettingsAssignmentsOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "listAccountSettingsAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listAccountSettingsAssignmentsOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listAccountSettingsAssignmentsOptions.accountId())); + } + if (listAccountSettingsAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listAccountSettingsAssignmentsOptions.templateId())); + } + if (listAccountSettingsAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listAccountSettingsAssignmentsOptions.templateVersion())); + } + if (listAccountSettingsAssignmentsOptions.target() != null) { + builder.query("target", String.valueOf(listAccountSettingsAssignmentsOptions.target())); + } + if (listAccountSettingsAssignmentsOptions.targetType() != null) { + builder.query("target_type", String.valueOf(listAccountSettingsAssignmentsOptions.targetType())); + } + if (listAccountSettingsAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listAccountSettingsAssignmentsOptions.limit())); + } + if (listAccountSettingsAssignmentsOptions.pagetoken() != null) { + builder.query("pagetoken", String.valueOf(listAccountSettingsAssignmentsOptions.pagetoken())); + } + if (listAccountSettingsAssignmentsOptions.sort() != null) { + builder.query("sort", String.valueOf(listAccountSettingsAssignmentsOptions.sort())); + } + if (listAccountSettingsAssignmentsOptions.order() != null) { + builder.query("order", String.valueOf(listAccountSettingsAssignmentsOptions.order())); + } + if (listAccountSettingsAssignmentsOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(listAccountSettingsAssignmentsOptions.includeHistory())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List assignments. + * + * List account settings assignments. + * + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentListResponse} + */ + public ServiceCall listAccountSettingsAssignments() { + return listAccountSettingsAssignments(null); + } + + /** + * Create assignment. + * + * Create an assigment for an account settings template. + * + * @param createAccountSettingsAssignmentOptions the {@link CreateAccountSettingsAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} + */ + public ServiceCall createAccountSettingsAssignment(CreateAccountSettingsAssignmentOptions createAccountSettingsAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createAccountSettingsAssignmentOptions, + "createAccountSettingsAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "createAccountSettingsAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_id", createAccountSettingsAssignmentOptions.templateId()); + contentJson.addProperty("template_version", createAccountSettingsAssignmentOptions.templateVersion()); + contentJson.addProperty("target_type", createAccountSettingsAssignmentOptions.targetType()); + contentJson.addProperty("target", createAccountSettingsAssignmentOptions.target()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get assignment. + * + * Get an assigment for an account settings template. + * + * @param getAccountSettingsAssignmentOptions the {@link GetAccountSettingsAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} + */ + public ServiceCall getAccountSettingsAssignment(GetAccountSettingsAssignmentOptions getAccountSettingsAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountSettingsAssignmentOptions, + "getAccountSettingsAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getAccountSettingsAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getAccountSettingsAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getAccountSettingsAssignmentOptions.includeHistory() != null) { + builder.query("include_history", String.valueOf(getAccountSettingsAssignmentOptions.includeHistory())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete assignment. + * + * Delete an account settings template assignment. This removes any IAM resources created by this assignment in child + * accounts. + * + * @param deleteAccountSettingsAssignmentOptions the {@link DeleteAccountSettingsAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ExceptionResponse} + */ + public ServiceCall deleteAccountSettingsAssignment(DeleteAccountSettingsAssignmentOptions deleteAccountSettingsAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccountSettingsAssignmentOptions, + "deleteAccountSettingsAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteAccountSettingsAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "deleteAccountSettingsAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update assignment. + * + * Update an account settings assignment. Call this method to retry failed assignments or migrate the settings in + * child accounts to a new version. + * + * @param updateAccountSettingsAssignmentOptions the {@link UpdateAccountSettingsAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TemplateAssignmentResponse} + */ + public ServiceCall updateAccountSettingsAssignment(UpdateAccountSettingsAssignmentOptions updateAccountSettingsAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccountSettingsAssignmentOptions, + "updateAccountSettingsAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateAccountSettingsAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/account_settings_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "updateAccountSettingsAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateAccountSettingsAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateAccountSettingsAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + } diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptions.java index 824123fc02..2da5848109 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptions.java @@ -23,6 +23,7 @@ public class CreateProfileOptions extends GenericModel { protected String name; protected String accountId; protected String description; + protected String email; /** * Builder. @@ -31,6 +32,7 @@ public static class Builder { private String name; private String accountId; private String description; + private String email; /** * Instantiates a new Builder from an existing CreateProfileOptions instance. @@ -41,6 +43,7 @@ private Builder(CreateProfileOptions createProfileOptions) { this.name = createProfileOptions.name; this.accountId = createProfileOptions.accountId; this.description = createProfileOptions.description; + this.email = createProfileOptions.email; } /** @@ -101,6 +104,17 @@ public Builder description(String description) { this.description = description; return this; } + + /** + * Set the email. + * + * @param email the email + * @return the CreateProfileOptions builder + */ + public Builder email(String email) { + this.email = email; + return this; + } } protected CreateProfileOptions() { } @@ -113,6 +127,7 @@ protected CreateProfileOptions(Builder builder) { name = builder.name; accountId = builder.accountId; description = builder.description; + email = builder.email; } /** @@ -158,5 +173,16 @@ public String accountId() { public String description() { return description; } + + /** + * Gets the email. + * + * The email of the trusted profile. + * + * @return the email + */ + public String email() { + return email; + } } diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdGroupOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdGroupOptions.java new file mode 100644 index 0000000000..a99668a97e --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdGroupOptions.java @@ -0,0 +1,160 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createServiceIdGroup options. + */ +public class CreateServiceIdGroupOptions extends GenericModel { + + protected String accountId; + protected String name; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String name; + private String description; + + /** + * Instantiates a new Builder from an existing CreateServiceIdGroupOptions instance. + * + * @param createServiceIdGroupOptions the instance to initialize the Builder with + */ + private Builder(CreateServiceIdGroupOptions createServiceIdGroupOptions) { + this.accountId = createServiceIdGroupOptions.accountId; + this.name = createServiceIdGroupOptions.name; + this.description = createServiceIdGroupOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param name the name + */ + public Builder(String accountId, String name) { + this.accountId = accountId; + this.name = name; + } + + /** + * Builds a CreateServiceIdGroupOptions. + * + * @return the new CreateServiceIdGroupOptions instance + */ + public CreateServiceIdGroupOptions build() { + return new CreateServiceIdGroupOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateServiceIdGroupOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateServiceIdGroupOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateServiceIdGroupOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected CreateServiceIdGroupOptions() { } + + protected CreateServiceIdGroupOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + accountId = builder.accountId; + name = builder.name; + description = builder.description; + } + + /** + * New builder. + * + * @return a CreateServiceIdGroupOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * ID of the account the service ID group belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the name. + * + * Name of the service ID group. Unique in the account. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the service ID group. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptions.java index aa184e58e8..e75200b528 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptions.java @@ -25,9 +25,11 @@ public class CreateServiceIdOptions extends GenericModel { protected String accountId; protected String name; + protected String groupId; protected String description; protected List uniqueInstanceCrns; protected ApiKeyInsideCreateServiceIdRequest apikey; + protected String showGroupId; protected String entityLock; /** @@ -36,9 +38,11 @@ public class CreateServiceIdOptions extends GenericModel { public static class Builder { private String accountId; private String name; + private String groupId; private String description; private List uniqueInstanceCrns; private ApiKeyInsideCreateServiceIdRequest apikey; + private String showGroupId; private String entityLock; /** @@ -49,9 +53,11 @@ public static class Builder { private Builder(CreateServiceIdOptions createServiceIdOptions) { this.accountId = createServiceIdOptions.accountId; this.name = createServiceIdOptions.name; + this.groupId = createServiceIdOptions.groupId; this.description = createServiceIdOptions.description; this.uniqueInstanceCrns = createServiceIdOptions.uniqueInstanceCrns; this.apikey = createServiceIdOptions.apikey; + this.showGroupId = createServiceIdOptions.showGroupId; this.entityLock = createServiceIdOptions.entityLock; } @@ -119,6 +125,17 @@ public Builder name(String name) { return this; } + /** + * Set the groupId. + * + * @param groupId the groupId + * @return the CreateServiceIdOptions builder + */ + public Builder groupId(String groupId) { + this.groupId = groupId; + return this; + } + /** * Set the description. * @@ -153,6 +170,17 @@ public Builder apikey(ApiKeyInsideCreateServiceIdRequest apikey) { return this; } + /** + * Set the showGroupId. + * + * @param showGroupId the showGroupId + * @return the CreateServiceIdOptions builder + */ + public Builder showGroupId(String showGroupId) { + this.showGroupId = showGroupId; + return this; + } + /** * Set the entityLock. * @@ -174,9 +202,11 @@ protected CreateServiceIdOptions(Builder builder) { "name cannot be null"); accountId = builder.accountId; name = builder.name; + groupId = builder.groupId; description = builder.description; uniqueInstanceCrns = builder.uniqueInstanceCrns; apikey = builder.apikey; + showGroupId = builder.showGroupId; entityLock = builder.entityLock; } @@ -212,6 +242,18 @@ public String name() { return name; } + /** + * Gets the groupId. + * + * ID of the group to which the service ID belongs to. If the value is not set, the service ID is bound to the default + * group. + * + * @return the groupId + */ + public String groupId() { + return groupId; + } + /** * Gets the description. * @@ -246,6 +288,17 @@ public ApiKeyInsideCreateServiceIdRequest apikey() { return apikey; } + /** + * Gets the showGroupId. + * + * Defines if the service ID group ID is included in the response. + * + * @return the showGroupId + */ + public String showGroupId() { + return showGroupId; + } + /** * Gets the entityLock. * diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/DeleteServiceIdGroupOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/DeleteServiceIdGroupOptions.java new file mode 100644 index 0000000000..1ec8747c6a --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/DeleteServiceIdGroupOptions.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteServiceIdGroup options. + */ +public class DeleteServiceIdGroupOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteServiceIdGroupOptions instance. + * + * @param deleteServiceIdGroupOptions the instance to initialize the Builder with + */ + private Builder(DeleteServiceIdGroupOptions deleteServiceIdGroupOptions) { + this.id = deleteServiceIdGroupOptions.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + */ + public Builder(String id) { + this.id = id; + } + + /** + * Builds a DeleteServiceIdGroupOptions. + * + * @return the new DeleteServiceIdGroupOptions instance + */ + public DeleteServiceIdGroupOptions build() { + return new DeleteServiceIdGroupOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteServiceIdGroupOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteServiceIdGroupOptions() { } + + protected DeleteServiceIdGroupOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteServiceIdGroupOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Unique ID of the service ID group. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdGroupOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdGroupOptions.java new file mode 100644 index 0000000000..eecd537102 --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdGroupOptions.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getServiceIdGroup options. + */ +public class GetServiceIdGroupOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing GetServiceIdGroupOptions instance. + * + * @param getServiceIdGroupOptions the instance to initialize the Builder with + */ + private Builder(GetServiceIdGroupOptions getServiceIdGroupOptions) { + this.id = getServiceIdGroupOptions.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + */ + public Builder(String id) { + this.id = id; + } + + /** + * Builds a GetServiceIdGroupOptions. + * + * @return the new GetServiceIdGroupOptions instance + */ + public GetServiceIdGroupOptions build() { + return new GetServiceIdGroupOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetServiceIdGroupOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected GetServiceIdGroupOptions() { } + + protected GetServiceIdGroupOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a GetServiceIdGroupOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Unique ID of the service ID group. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptions.java index cf425b4916..8fa07c9b05 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptions.java @@ -23,6 +23,7 @@ public class GetServiceIdOptions extends GenericModel { protected String id; protected Boolean includeHistory; protected Boolean includeActivity; + protected String showGroupId; /** * Builder. @@ -31,6 +32,7 @@ public static class Builder { private String id; private Boolean includeHistory; private Boolean includeActivity; + private String showGroupId; /** * Instantiates a new Builder from an existing GetServiceIdOptions instance. @@ -41,6 +43,7 @@ private Builder(GetServiceIdOptions getServiceIdOptions) { this.id = getServiceIdOptions.id; this.includeHistory = getServiceIdOptions.includeHistory; this.includeActivity = getServiceIdOptions.includeActivity; + this.showGroupId = getServiceIdOptions.showGroupId; } /** @@ -99,6 +102,17 @@ public Builder includeActivity(Boolean includeActivity) { this.includeActivity = includeActivity; return this; } + + /** + * Set the showGroupId. + * + * @param showGroupId the showGroupId + * @return the GetServiceIdOptions builder + */ + public Builder showGroupId(String showGroupId) { + this.showGroupId = showGroupId; + return this; + } } protected GetServiceIdOptions() { } @@ -109,6 +123,7 @@ protected GetServiceIdOptions(Builder builder) { id = builder.id; includeHistory = builder.includeHistory; includeActivity = builder.includeActivity; + showGroupId = builder.showGroupId; } /** @@ -153,5 +168,16 @@ public Boolean includeHistory() { public Boolean includeActivity() { return includeActivity; } + + /** + * Gets the showGroupId. + * + * Defines if the service ID group ID is included in the response. + * + * @return the showGroupId + */ + public String showGroupId() { + return showGroupId; + } } diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/IdentityPreferencesResponse.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/IdentityPreferencesResponse.java new file mode 100644 index 0000000000..5168b3c3c8 --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/IdentityPreferencesResponse.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * IdentityPreferencesResponse. + */ +public class IdentityPreferencesResponse extends GenericModel { + + protected List preferences; + + protected IdentityPreferencesResponse() { } + + /** + * Gets the preferences. + * + * List of Identity Preferences. + * + * @return the preferences + */ + public List getPreferences() { + return preferences; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptions.java index a93c7a6871..343f1f3893 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptions.java @@ -60,6 +60,7 @@ public interface Order { protected String order; protected Boolean includeHistory; protected String filter; + protected String groupId; /** * Builder. @@ -75,6 +76,7 @@ public static class Builder { private String order; private Boolean includeHistory; private String filter; + private String groupId; /** * Instantiates a new Builder from an existing ListApiKeysOptions instance. @@ -92,6 +94,7 @@ private Builder(ListApiKeysOptions listApiKeysOptions) { this.order = listApiKeysOptions.order; this.includeHistory = listApiKeysOptions.includeHistory; this.filter = listApiKeysOptions.filter; + this.groupId = listApiKeysOptions.groupId; } /** @@ -218,6 +221,17 @@ public Builder filter(String filter) { this.filter = filter; return this; } + + /** + * Set the groupId. + * + * @param groupId the groupId + * @return the ListApiKeysOptions builder + */ + public Builder groupId(String groupId) { + this.groupId = groupId; + return this; + } } protected ListApiKeysOptions() { } @@ -233,6 +247,7 @@ protected ListApiKeysOptions(Builder builder) { order = builder.order; includeHistory = builder.includeHistory; filter = builder.filter; + groupId = builder.groupId; } /** @@ -358,5 +373,18 @@ public Boolean includeHistory() { public String filter() { return filter; } + + /** + * Gets the groupId. + * + * Optional group ID of the service ID(s) to which the searched API keys are bound. If this parameter is not provided + * the default group is applied on service ID API keys. For user API keys this parameter is ignored as they always + * belong to the default group. + * + * @return the groupId + */ + public String groupId() { + return groupId; + } } diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdGroupOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdGroupOptions.java new file mode 100644 index 0000000000..88a5dd40d2 --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdGroupOptions.java @@ -0,0 +1,93 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listServiceIdGroup options. + */ +public class ListServiceIdGroupOptions extends GenericModel { + + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + + /** + * Instantiates a new Builder from an existing ListServiceIdGroupOptions instance. + * + * @param listServiceIdGroupOptions the instance to initialize the Builder with + */ + private Builder(ListServiceIdGroupOptions listServiceIdGroupOptions) { + this.accountId = listServiceIdGroupOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListServiceIdGroupOptions. + * + * @return the new ListServiceIdGroupOptions instance + */ + public ListServiceIdGroupOptions build() { + return new ListServiceIdGroupOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListServiceIdGroupOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + protected ListServiceIdGroupOptions() { } + + protected ListServiceIdGroupOptions(Builder builder) { + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a ListServiceIdGroupOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * Account ID of the service ID groups to query. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptions.java index f9ea16de3a..c557411962 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptions.java @@ -31,6 +31,7 @@ public interface Order { } protected String accountId; + protected String groupId; protected String name; protected Long pagesize; protected String pagetoken; @@ -38,12 +39,14 @@ public interface Order { protected String order; protected Boolean includeHistory; protected String filter; + protected String showGroupId; /** * Builder. */ public static class Builder { private String accountId; + private String groupId; private String name; private Long pagesize; private String pagetoken; @@ -51,6 +54,7 @@ public static class Builder { private String order; private Boolean includeHistory; private String filter; + private String showGroupId; /** * Instantiates a new Builder from an existing ListServiceIdsOptions instance. @@ -59,6 +63,7 @@ public static class Builder { */ private Builder(ListServiceIdsOptions listServiceIdsOptions) { this.accountId = listServiceIdsOptions.accountId; + this.groupId = listServiceIdsOptions.groupId; this.name = listServiceIdsOptions.name; this.pagesize = listServiceIdsOptions.pagesize; this.pagetoken = listServiceIdsOptions.pagetoken; @@ -66,6 +71,7 @@ private Builder(ListServiceIdsOptions listServiceIdsOptions) { this.order = listServiceIdsOptions.order; this.includeHistory = listServiceIdsOptions.includeHistory; this.filter = listServiceIdsOptions.filter; + this.showGroupId = listServiceIdsOptions.showGroupId; } /** @@ -94,6 +100,17 @@ public Builder accountId(String accountId) { return this; } + /** + * Set the groupId. + * + * @param groupId the groupId + * @return the ListServiceIdsOptions builder + */ + public Builder groupId(String groupId) { + this.groupId = groupId; + return this; + } + /** * Set the name. * @@ -170,12 +187,24 @@ public Builder filter(String filter) { this.filter = filter; return this; } + + /** + * Set the showGroupId. + * + * @param showGroupId the showGroupId + * @return the ListServiceIdsOptions builder + */ + public Builder showGroupId(String showGroupId) { + this.showGroupId = showGroupId; + return this; + } } protected ListServiceIdsOptions() { } protected ListServiceIdsOptions(Builder builder) { accountId = builder.accountId; + groupId = builder.groupId; name = builder.name; pagesize = builder.pagesize; pagetoken = builder.pagetoken; @@ -183,6 +212,7 @@ protected ListServiceIdsOptions(Builder builder) { order = builder.order; includeHistory = builder.includeHistory; filter = builder.filter; + showGroupId = builder.showGroupId; } /** @@ -205,6 +235,17 @@ public String accountId() { return accountId; } + /** + * Gets the groupId. + * + * Group ID of the service ID(s) to query. If this parameter is not provided the default group is applied. + * + * @return the groupId + */ + public String groupId() { + return groupId; + } + /** * Gets the name. * @@ -283,5 +324,16 @@ public Boolean includeHistory() { public String filter() { return filter; } + + /** + * Gets the showGroupId. + * + * Defines if the service ID group ID is included in the response. + * + * @return the showGroupId + */ + public String showGroupId() { + return showGroupId; + } } diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceId.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceId.java index cd8b71ccbd..ae779456b4 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceId.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceId.java @@ -38,6 +38,8 @@ public class ServiceId extends GenericModel { protected Date modifiedAt; @SerializedName("account_id") protected String accountId; + @SerializedName("group_id") + protected String groupId; protected String name; protected String description; @SerializedName("unique_instance_crns") @@ -149,6 +151,17 @@ public String getAccountId() { return accountId; } + /** + * Gets the groupId. + * + * ID of the group to which the service ID belongs to. Only set if requested via parameter `show_group_id`. + * + * @return the groupId + */ + public String getGroupId() { + return groupId; + } + /** * Gets the name. * diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroup.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroup.java new file mode 100644 index 0000000000..8243ed2a67 --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroup.java @@ -0,0 +1,141 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ServiceIdGroup. + */ +public class ServiceIdGroup extends GenericModel { + + protected String id; + @SerializedName("entity_tag") + protected String entityTag; + @SerializedName("account_id") + protected String accountId; + protected String crn; + protected String name; + protected String description; + @SerializedName("created_at") + protected String createdAt; + @SerializedName("created_by") + protected String createdBy; + @SerializedName("modified_at") + protected String modifiedAt; + + protected ServiceIdGroup() { } + + /** + * Gets the id. + * + * ID of the the service ID group. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the entityTag. + * + * Version of the service ID group details object. You need to specify this value when updating the service ID group + * to avoid stale updates. + * + * @return the entityTag + */ + public String getEntityTag() { + return entityTag; + } + + /** + * Gets the accountId. + * + * ID of the account the service ID group belongs to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the crn. + * + * Cloud Resource Name of the item. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * Name of the service ID group. Unique in the account. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the service ID group. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the createdAt. + * + * Timestamp of when the service ID group was created. + * + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdBy. + * + * IAM ID of the user or service which created the Service Id group. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Gets the modifiedAt. + * + * Timestamp of when the service ID group was modified. + * + * @return the modifiedAt + */ + public String getModifiedAt() { + return modifiedAt; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupList.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupList.java new file mode 100644 index 0000000000..a04598279c --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupList.java @@ -0,0 +1,42 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ServiceIdGroupList. + */ +public class ServiceIdGroupList extends GenericModel { + + @SerializedName("serviceid_groups") + protected List serviceidGroups; + + protected ServiceIdGroupList() { } + + /** + * Gets the serviceidGroups. + * + * List of Service ID groups based on the query parameter. + * + * @return the serviceidGroups + */ + public List getServiceidGroups() { + return serviceidGroups; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequest.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequest.java index 9bdaa2e2a3..4497226ed8 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequest.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequest.java @@ -25,6 +25,7 @@ public class TemplateProfileComponentRequest extends GenericModel { protected String name; protected String description; + protected String email; protected List rules; protected List identities; @@ -34,6 +35,7 @@ public class TemplateProfileComponentRequest extends GenericModel { public static class Builder { private String name; private String description; + private String email; private List rules; private List identities; @@ -45,6 +47,7 @@ public static class Builder { private Builder(TemplateProfileComponentRequest templateProfileComponentRequest) { this.name = templateProfileComponentRequest.name; this.description = templateProfileComponentRequest.description; + this.email = templateProfileComponentRequest.email; this.rules = templateProfileComponentRequest.rules; this.identities = templateProfileComponentRequest.identities; } @@ -127,6 +130,17 @@ public Builder description(String description) { return this; } + /** + * Set the email. + * + * @param email the email + * @return the TemplateProfileComponentRequest builder + */ + public Builder email(String email) { + this.email = email; + return this; + } + /** * Set the rules. * Existing rules will be replaced. @@ -159,6 +173,7 @@ protected TemplateProfileComponentRequest(Builder builder) { "name cannot be null"); name = builder.name; description = builder.description; + email = builder.email; rules = builder.rules; identities = builder.identities; } @@ -177,6 +192,24 @@ public Builder newBuilder() { * * Name of the Profile. * + * You can use replacement variables in the profile name to adjust the name per account. + * + * The following variables are supported: + * + * - `${template_id}` will be replaced by a unique identifier representing the trusted profile template + * + * - `${template_name}` will be replaced by the current name of the trusted profile template + * + * - `${template_version}` will be replaced by the current version of the trusted profile template + * + * - `${account_id}` will be replaced by the account identifier to which this trusted profile template is assigned to + * + * - `${account_name}` will be replaced by the account name to which this trusted profile template is assigned to + * + * Changes to e.g. the name of the account will NOT cause an update of the trusted profile name. The profile name is + * processed during account assignment and any template version upgrade, i.e. during that operation, the updated + * account name would be used. + * * @return the name */ public String name() { @@ -194,6 +227,17 @@ public String description() { return description; } + /** + * Gets the email. + * + * Email of the trusted profile. + * + * @return the email + */ + public String email() { + return email; + } + /** * Gets the rules. * diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponse.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponse.java index 5c47a40740..e7ce5ec56b 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponse.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponse.java @@ -25,6 +25,7 @@ public class TemplateProfileComponentResponse extends GenericModel { protected String name; protected String description; protected List rules; + protected String email; protected List identities; protected TemplateProfileComponentResponse() { } @@ -62,6 +63,17 @@ public List getRules() { return rules; } + /** + * Gets the email. + * + * Email of the trusted profile. + * + * @return the email + */ + public String getEmail() { + return email; + } + /** * Gets the identities. * diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfile.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfile.java index b5120e09d7..b9af98f87f 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfile.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfile.java @@ -31,6 +31,7 @@ public class TrustedProfile extends GenericModel { protected String crn; protected String name; protected String description; + protected String email; @SerializedName("created_at") protected Date createdAt; @SerializedName("modified_at") @@ -122,6 +123,18 @@ public String getDescription() { return description; } + /** + * Gets the email. + * + * The optional email of the trusted profile. The 'email' property is only available if an email was provided during a + * create of a trusted profile. + * + * @return the email + */ + public String getEmail() { + return email; + } + /** * Gets the createdAt. * diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptions.java index cc1ff75f0f..e9ff257aaf 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptions.java @@ -24,6 +24,7 @@ public class UpdateProfileOptions extends GenericModel { protected String ifMatch; protected String name; protected String description; + protected String email; /** * Builder. @@ -33,6 +34,7 @@ public static class Builder { private String ifMatch; private String name; private String description; + private String email; /** * Instantiates a new Builder from an existing UpdateProfileOptions instance. @@ -44,6 +46,7 @@ private Builder(UpdateProfileOptions updateProfileOptions) { this.ifMatch = updateProfileOptions.ifMatch; this.name = updateProfileOptions.name; this.description = updateProfileOptions.description; + this.email = updateProfileOptions.email; } /** @@ -115,6 +118,17 @@ public Builder description(String description) { this.description = description; return this; } + + /** + * Set the email. + * + * @param email the email + * @return the UpdateProfileOptions builder + */ + public Builder email(String email) { + this.email = email; + return this; + } } protected UpdateProfileOptions() { } @@ -128,6 +142,7 @@ protected UpdateProfileOptions(Builder builder) { ifMatch = builder.ifMatch; name = builder.name; description = builder.description; + email = builder.email; } /** @@ -186,5 +201,17 @@ public String name() { public String description() { return description; } + + /** + * Gets the email. + * + * The email of the profile to update. If specified an empty email will clear the email of the profile. If an non + * empty value is provided the trusted profile will be updated. + * + * @return the email + */ + public String email() { + return email; + } } diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdGroupOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdGroupOptions.java new file mode 100644 index 0000000000..fff0253fbe --- /dev/null +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdGroupOptions.java @@ -0,0 +1,192 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateServiceIdGroup options. + */ +public class UpdateServiceIdGroupOptions extends GenericModel { + + protected String id; + protected String ifMatch; + protected String name; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private String name; + private String description; + + /** + * Instantiates a new Builder from an existing UpdateServiceIdGroupOptions instance. + * + * @param updateServiceIdGroupOptions the instance to initialize the Builder with + */ + private Builder(UpdateServiceIdGroupOptions updateServiceIdGroupOptions) { + this.id = updateServiceIdGroupOptions.id; + this.ifMatch = updateServiceIdGroupOptions.ifMatch; + this.name = updateServiceIdGroupOptions.name; + this.description = updateServiceIdGroupOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param name the name + */ + public Builder(String id, String ifMatch, String name) { + this.id = id; + this.ifMatch = ifMatch; + this.name = name; + } + + /** + * Builds a UpdateServiceIdGroupOptions. + * + * @return the new UpdateServiceIdGroupOptions instance + */ + public UpdateServiceIdGroupOptions build() { + return new UpdateServiceIdGroupOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the UpdateServiceIdGroupOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateServiceIdGroupOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateServiceIdGroupOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the UpdateServiceIdGroupOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected UpdateServiceIdGroupOptions() { } + + protected UpdateServiceIdGroupOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + } + + /** + * New builder. + * + * @return a UpdateServiceIdGroupOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Unique ID of the service ID group to be updated. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * Version of the service ID gorup to be updated. Specify the version that you retrieved when reading service ID + * group. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. + * This might result in stale updates. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Name of the service ID group. Unique in the account. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the service ID group. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptions.java b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptions.java index 512e08fc3e..832d20168b 100644 --- a/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptions.java +++ b/modules/iam-identity/src/main/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptions.java @@ -28,6 +28,7 @@ public class UpdateServiceIdOptions extends GenericModel { protected String name; protected String description; protected List uniqueInstanceCrns; + protected String showGroupId; /** * Builder. @@ -38,6 +39,7 @@ public static class Builder { private String name; private String description; private List uniqueInstanceCrns; + private String showGroupId; /** * Instantiates a new Builder from an existing UpdateServiceIdOptions instance. @@ -50,6 +52,7 @@ private Builder(UpdateServiceIdOptions updateServiceIdOptions) { this.name = updateServiceIdOptions.name; this.description = updateServiceIdOptions.description; this.uniqueInstanceCrns = updateServiceIdOptions.uniqueInstanceCrns; + this.showGroupId = updateServiceIdOptions.showGroupId; } /** @@ -149,6 +152,17 @@ public Builder uniqueInstanceCrns(List uniqueInstanceCrns) { this.uniqueInstanceCrns = uniqueInstanceCrns; return this; } + + /** + * Set the showGroupId. + * + * @param showGroupId the showGroupId + * @return the UpdateServiceIdOptions builder + */ + public Builder showGroupId(String showGroupId) { + this.showGroupId = showGroupId; + return this; + } } protected UpdateServiceIdOptions() { } @@ -163,6 +177,7 @@ protected UpdateServiceIdOptions(Builder builder) { name = builder.name; description = builder.description; uniqueInstanceCrns = builder.uniqueInstanceCrns; + showGroupId = builder.showGroupId; } /** @@ -233,5 +248,16 @@ public String description() { public List uniqueInstanceCrns() { return uniqueInstanceCrns; } + + /** + * Gets the showGroupId. + * + * Defines if the service ID group ID is included in the response. + * + * @return the showGroupId + */ + public String showGroupId() { + return showGroupId; + } } diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityIT.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityIT.java index 6b4a64dc12..0b5fea27d7 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityIT.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityIT.java @@ -47,6 +47,7 @@ public class IamIdentityIT extends SdkIntegrationTestBase { private static String APIKEY_NAME = "Java-SDK-IT-ApiKey"; private static String SERVICEID_NAME = "Java-SDK-IT-ServiceId"; + private static String SERVICEID_GROUP_NAME = "Java-SDK-IT-ServiceId-Group"; private static String PROFILE_NAME_1 = "Java-SDK-IT-TrustedProfile1"; private static String PROFILE_NAME_2 = "Java-SDK-IT-TrustedProfile2"; private static String CLAIMRULE_TYPE = "Profile-SAML"; @@ -78,6 +79,7 @@ public class IamIdentityIT extends SdkIntegrationTestBase { private String serviceId1; private String serviceIdEtag1; + private String serviceIdGroupId; private String profileId1; private String profile1IamId; @@ -797,6 +799,117 @@ public void testGetServiceIdNegative() throws Exception { } } + @Test + public void testCreateServiceIDGroup() throws Exception { + try { + CreateServiceIdGroupOptions createServiceIdGroupOptions = new CreateServiceIdGroupOptions.Builder() + .accountId(ACCOUNT_ID) + .name(SERVICEID_GROUP_NAME) + .description("JavaSDK test ServiceID Group") + .build(); + + Response response = service.createServiceIdGroup(createServiceIdGroupOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 201); + + ServiceIdGroup serviceIdGroupResult = response.getResult(); + assertNotNull(serviceIdGroupResult); + + // Save the id for use by other test methods. + serviceIdGroupId = serviceIdGroupResult.getId(); + assertNotNull(serviceIdGroupId); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testCreateServiceIDGroup" }) + public void testGetServiceIDGroup() throws Exception { + try { + GetServiceIdGroupOptions getServiceIdGroupOptions = new GetServiceIdGroupOptions.Builder() + .id(serviceIdGroupId) + .build(); + + Response response = service.getServiceIdGroup(getServiceIdGroupOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ServiceIdGroup serviceIdGroupResult = response.getResult(); + assertNotNull(serviceIdGroupResult); + + assertEquals(serviceIdGroupResult.getAccountId(), ACCOUNT_ID); + assertEquals(serviceIdGroupResult.getName(), SERVICEID_GROUP_NAME); + assertEquals(serviceIdGroupResult.getDescription(), "JavaSDK test ServiceID Group"); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testListServiceIDGroup() throws Exception { + try { + ListServiceIdGroupOptions listServiceIdGroupOptions = new ListServiceIdGroupOptions.Builder() + .accountId(ACCOUNT_ID) + .build(); + + Response response = service.listServiceIdGroup(listServiceIdGroupOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ServiceIdGroupList serviceIdGroupListResult = response.getResult(); + assertNotNull(serviceIdGroupListResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testCreateServiceIDGroup" }) + public void testUpdateServiceIDGroup() throws Exception { + try { + String newDescription = "This is an updated description."; + UpdateServiceIdGroupOptions updateServiceIdGroupOptions = new UpdateServiceIdGroupOptions.Builder() + .id(serviceIdGroupId) + .description(newDescription) + .build(); + + Response response = service.updateServiceIdGroup(updateServiceIdGroupOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ServiceIdGroup serviceIdGroupResult = response.getResult(); + assertNotNull(serviceIdGroupResult); + + assertEquals(serviceIdGroupResult.getAccountId(), ACCOUNT_ID); + assertEquals(serviceIdGroupResult.getName(), SERVICEID_GROUP_NAME); + assertEquals(serviceIdGroupResult.getDescription(), newDescription); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testUpdateServiceIDGroup" }) + public void testDeleteServiceIDGroup() throws Exception { + try { + String newDescription = "This is an updated description."; + DeleteServiceIdGroupOptions deleteServiceIdGroupOptions = new DeleteServiceIdGroupOptions.Builder() + .id(serviceIdGroupId) + .build(); + + Response response = service.deleteServiceIdGroup(deleteServiceIdGroupOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 204); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + @Test public void testCreateProfile1() throws Exception { try { @@ -2790,7 +2903,7 @@ public void testGetAllPreferencesOnScopeAccount() throws Exception { .iamId(IAM_ID) .build(); - Response response = service.getAllPreferencesOnScopeAccount(getAllPreferencesOption).execute(); + Response response = service.getAllPreferencesOnScopeAccount(getAllPreferencesOption).execute(); assertNotNull(response); assertEquals(response.getStatusCode(), 200); @@ -2815,7 +2928,7 @@ public void testDeletePreferenceOnScopeAccount() throws Exception { Response response = service.deletePreferencesOnScopeAccount(deletePreferenceOption).execute(); assertNotNull(response); - assertEquals(response.getStatusCode(), 204); + assertEquals(response.getStatusCode(), 202); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s\nError details: %s", diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityTest.java index 71b2fc46ac..b5e1c16030 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/IamIdentityTest.java @@ -28,7 +28,6 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.ActionControlsPolicies; import com.ibm.cloud.platform_services.iam_identity.v1.model.ActionControlsRules; import com.ibm.cloud.platform_services.iam_identity.v1.model.Activity; -import com.ibm.cloud.platform_services.iam_identity.v1.model.AllIdentityPreferencesResponse; import com.ibm.cloud.platform_services.iam_identity.v1.model.ApiKey; import com.ibm.cloud.platform_services.iam_identity.v1.model.ApiKeyInsideCreateServiceIdRequest; import com.ibm.cloud.platform_services.iam_identity.v1.model.ApiKeyList; @@ -49,6 +48,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateProfileTemplateOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateProfileTemplateVersionOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateReportOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteAccountSettingsAssignmentOptions; @@ -62,6 +62,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteProfileIdentityOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteProfileOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteProfileTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.DisableApiKeyOptions; @@ -91,10 +92,12 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.GetProfileOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetProfileTemplateVersionOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetReportOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.GetServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.GetTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.IdBasedMfaEnrollment; import com.ibm.cloud.platform_services.iam_identity.v1.model.IdentityPreferenceResponse; +import com.ibm.cloud.platform_services.iam_identity.v1.model.IdentityPreferencesResponse; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListAccountSettingsAssignmentsOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListAccountSettingsTemplatesOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListApiKeysOptions; @@ -102,6 +105,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.ListLinksOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListProfileTemplatesOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListProfilesOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ListServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListServiceIdsOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListTrustedProfileAssignmentsOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.ListVersionsOfAccountSettingsTemplateOptions; @@ -125,6 +129,8 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.ReportReference; import com.ibm.cloud.platform_services.iam_identity.v1.model.ResponseContext; import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceId; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroup; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroupList; import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdList; import com.ibm.cloud.platform_services.iam_identity.v1.model.SetProfileIdentitiesOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.SetProfileIdentityOptions; @@ -151,6 +157,7 @@ import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdatePreferenceOnScopeAccountOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateProfileOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateProfileTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateServiceIdGroupOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateServiceIdOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateTrustedProfileAssignmentOptions; import com.ibm.cloud.platform_services.iam_identity.v1.model.UserActivity; @@ -193,35 +200,35 @@ public void testConstructorWithNullAuthenticator() throws Throwable { new IamIdentity(serviceName, null); } - // Test the listApiKeys operation with a valid options model parameter + // Test the listServiceIds operation with a valid options model parameter @Test - public void testListApiKeysWOptions() throws Throwable { + public void testListServiceIdsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"apikeys\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}]}"; - String listApiKeysPath = "/v1/apikeys"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"serviceids\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"group_id\": \"groupId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}]}"; + String listServiceIdsPath = "/v1/serviceids/"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListApiKeysOptions model - ListApiKeysOptions listApiKeysOptionsModel = new ListApiKeysOptions.Builder() + // Construct an instance of the ListServiceIdsOptions model + ListServiceIdsOptions listServiceIdsOptionsModel = new ListServiceIdsOptions.Builder() .accountId("testString") - .iamId("testString") + .groupId("testString") + .name("testString") .pagesize(Long.valueOf("26")) .pagetoken("testString") - .scope("entity") - .type("user") .sort("testString") .order("asc") .includeHistory(false) .filter("testString") + .showGroupId("testString") .build(); - // Invoke listApiKeys() with a valid options model and verify the result - Response response = iamIdentityService.listApiKeys(listApiKeysOptionsModel).execute(); + // Invoke listServiceIds() with a valid options model and verify the result + Response response = iamIdentityService.listServiceIds(listServiceIdsOptionsModel).execute(); assertNotNull(response); - ApiKeyList responseObj = response.getResult(); + ServiceIdList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -230,61 +237,67 @@ public void testListApiKeysWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listApiKeysPath); + assertEquals(parsedPath, listServiceIdsPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("iam_id"), "testString"); + assertEquals(query.get("group_id"), "testString"); + assertEquals(query.get("name"), "testString"); assertEquals(Long.valueOf(query.get("pagesize")), Long.valueOf("26")); assertEquals(query.get("pagetoken"), "testString"); - assertEquals(query.get("scope"), "entity"); - assertEquals(query.get("type"), "user"); assertEquals(query.get("sort"), "testString"); assertEquals(query.get("order"), "asc"); assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); assertEquals(query.get("filter"), "testString"); + assertEquals(query.get("show_group_id"), "testString"); } - // Test the listApiKeys operation with and without retries enabled + // Test the listServiceIds operation with and without retries enabled @Test - public void testListApiKeysWRetries() throws Throwable { + public void testListServiceIdsWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListApiKeysWOptions(); + testListServiceIdsWOptions(); iamIdentityService.disableRetries(); - testListApiKeysWOptions(); + testListServiceIdsWOptions(); } - // Test the createApiKey operation with a valid options model parameter + // Test the createServiceId operation with a valid options model parameter @Test - public void testCreateApiKeyWOptions() throws Throwable { + public void testCreateServiceIdWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String createApiKeyPath = "/v1/apikeys"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"group_id\": \"groupId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String createServiceIdPath = "/v1/serviceids/"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the CreateApiKeyOptions model - CreateApiKeyOptions createApiKeyOptionsModel = new CreateApiKeyOptions.Builder() + // Construct an instance of the ApiKeyInsideCreateServiceIdRequest model + ApiKeyInsideCreateServiceIdRequest apiKeyInsideCreateServiceIdRequestModel = new ApiKeyInsideCreateServiceIdRequest.Builder() .name("testString") - .iamId("testString") .description("testString") - .accountId("testString") .apikey("testString") .storeValue(true) - .supportSessions(true) - .actionWhenLeaked("testString") + .build(); + + // Construct an instance of the CreateServiceIdOptions model + CreateServiceIdOptions createServiceIdOptionsModel = new CreateServiceIdOptions.Builder() + .accountId("testString") + .name("testString") + .groupId("testString") + .description("testString") + .uniqueInstanceCrns(java.util.Arrays.asList("testString")) + .apikey(apiKeyInsideCreateServiceIdRequestModel) + .showGroupId("testString") .entityLock("false") - .entityDisable("false") .build(); - // Invoke createApiKey() with a valid options model and verify the result - Response response = iamIdentityService.createApiKey(createApiKeyOptionsModel).execute(); + // Invoke createServiceId() with a valid options model and verify the result + Response response = iamIdentityService.createServiceId(createServiceIdOptionsModel).execute(); assertNotNull(response); - ApiKey responseObj = response.getResult(); + ServiceId responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -293,97 +306,53 @@ public void testCreateApiKeyWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createApiKeyPath); - // Verify that there is no query string + assertEquals(parsedPath, createServiceIdPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("show_group_id"), "testString"); } - // Test the createApiKey operation with and without retries enabled + // Test the createServiceId operation with and without retries enabled @Test - public void testCreateApiKeyWRetries() throws Throwable { + public void testCreateServiceIdWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateApiKeyWOptions(); + testCreateServiceIdWOptions(); iamIdentityService.disableRetries(); - testCreateApiKeyWOptions(); + testCreateServiceIdWOptions(); } - // Test the createApiKey operation with a null options model (negative test) + // Test the createServiceId operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateApiKeyNoOptions() throws Throwable { + public void testCreateServiceIdNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createApiKey(null).execute(); - } - - // Test the getApiKeysDetails operation with a valid options model parameter - @Test - public void testGetApiKeysDetailsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String getApiKeysDetailsPath = "/v1/apikeys/details"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetApiKeysDetailsOptions model - GetApiKeysDetailsOptions getApiKeysDetailsOptionsModel = new GetApiKeysDetailsOptions.Builder() - .iamApiKey("testString") - .includeHistory(false) - .build(); - - // Invoke getApiKeysDetails() with a valid options model and verify the result - Response response = iamIdentityService.getApiKeysDetails(getApiKeysDetailsOptionsModel).execute(); - assertNotNull(response); - ApiKey responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getApiKeysDetailsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); - } - - // Test the getApiKeysDetails operation with and without retries enabled - @Test - public void testGetApiKeysDetailsWRetries() throws Throwable { - iamIdentityService.enableRetries(4, 30); - testGetApiKeysDetailsWOptions(); - - iamIdentityService.disableRetries(); - testGetApiKeysDetailsWOptions(); + iamIdentityService.createServiceId(null).execute(); } - // Test the getApiKey operation with a valid options model parameter + // Test the getServiceId operation with a valid options model parameter @Test - public void testGetApiKeyWOptions() throws Throwable { + public void testGetServiceIdWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String getApiKeyPath = "/v1/apikeys/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"group_id\": \"groupId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String getServiceIdPath = "/v1/serviceids/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetApiKeyOptions model - GetApiKeyOptions getApiKeyOptionsModel = new GetApiKeyOptions.Builder() + // Construct an instance of the GetServiceIdOptions model + GetServiceIdOptions getServiceIdOptionsModel = new GetServiceIdOptions.Builder() .id("testString") .includeHistory(false) .includeActivity(false) + .showGroupId("testString") .build(); - // Invoke getApiKey() with a valid options model and verify the result - Response response = iamIdentityService.getApiKey(getApiKeyOptionsModel).execute(); + // Invoke getServiceId() with a valid options model and verify the result + Response response = iamIdentityService.getServiceId(getServiceIdOptionsModel).execute(); assertNotNull(response); - ApiKey responseObj = response.getResult(); + ServiceId responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -392,56 +361,57 @@ public void testGetApiKeyWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getApiKeyPath); + assertEquals(parsedPath, getServiceIdPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); assertEquals(Boolean.valueOf(query.get("include_activity")), Boolean.valueOf(false)); + assertEquals(query.get("show_group_id"), "testString"); } - // Test the getApiKey operation with and without retries enabled + // Test the getServiceId operation with and without retries enabled @Test - public void testGetApiKeyWRetries() throws Throwable { + public void testGetServiceIdWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetApiKeyWOptions(); + testGetServiceIdWOptions(); iamIdentityService.disableRetries(); - testGetApiKeyWOptions(); + testGetServiceIdWOptions(); } - // Test the getApiKey operation with a null options model (negative test) + // Test the getServiceId operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetApiKeyNoOptions() throws Throwable { + public void testGetServiceIdNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getApiKey(null).execute(); + iamIdentityService.getServiceId(null).execute(); } - // Test the updateApiKey operation with a valid options model parameter + // Test the updateServiceId operation with a valid options model parameter @Test - public void testUpdateApiKeyWOptions() throws Throwable { + public void testUpdateServiceIdWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String updateApiKeyPath = "/v1/apikeys/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"group_id\": \"groupId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String updateServiceIdPath = "/v1/serviceids/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the UpdateApiKeyOptions model - UpdateApiKeyOptions updateApiKeyOptionsModel = new UpdateApiKeyOptions.Builder() + // Construct an instance of the UpdateServiceIdOptions model + UpdateServiceIdOptions updateServiceIdOptionsModel = new UpdateServiceIdOptions.Builder() .id("testString") .ifMatch("testString") .name("testString") .description("testString") - .supportSessions(true) - .actionWhenLeaked("testString") + .uniqueInstanceCrns(java.util.Arrays.asList("testString")) + .showGroupId("testString") .build(); - // Invoke updateApiKey() with a valid options model and verify the result - Response response = iamIdentityService.updateApiKey(updateApiKeyOptionsModel).execute(); + // Invoke updateServiceId() with a valid options model and verify the result + Response response = iamIdentityService.updateServiceId(updateServiceIdOptionsModel).execute(); assertNotNull(response); - ApiKey responseObj = response.getResult(); + ServiceId responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -450,48 +420,49 @@ public void testUpdateApiKeyWOptions() throws Throwable { assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateApiKeyPath); + assertEquals(parsedPath, updateServiceIdPath); // Verify header parameters assertEquals(request.getHeader("If-Match"), "testString"); - // Verify that there is no query string + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("show_group_id"), "testString"); } - // Test the updateApiKey operation with and without retries enabled + // Test the updateServiceId operation with and without retries enabled @Test - public void testUpdateApiKeyWRetries() throws Throwable { + public void testUpdateServiceIdWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateApiKeyWOptions(); + testUpdateServiceIdWOptions(); iamIdentityService.disableRetries(); - testUpdateApiKeyWOptions(); + testUpdateServiceIdWOptions(); } - // Test the updateApiKey operation with a null options model (negative test) + // Test the updateServiceId operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateApiKeyNoOptions() throws Throwable { + public void testUpdateServiceIdNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateApiKey(null).execute(); + iamIdentityService.updateServiceId(null).execute(); } - // Test the deleteApiKey operation with a valid options model parameter + // Test the deleteServiceId operation with a valid options model parameter @Test - public void testDeleteApiKeyWOptions() throws Throwable { + public void testDeleteServiceIdWOptions() throws Throwable { // Register a mock response String mockResponseBody = ""; - String deleteApiKeyPath = "/v1/apikeys/testString"; + String deleteServiceIdPath = "/v1/serviceids/testString"; server.enqueue(new MockResponse() .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the DeleteApiKeyOptions model - DeleteApiKeyOptions deleteApiKeyOptionsModel = new DeleteApiKeyOptions.Builder() + // Construct an instance of the DeleteServiceIdOptions model + DeleteServiceIdOptions deleteServiceIdOptionsModel = new DeleteServiceIdOptions.Builder() .id("testString") .build(); - // Invoke deleteApiKey() with a valid options model and verify the result - Response response = iamIdentityService.deleteApiKey(deleteApiKeyOptionsModel).execute(); + // Invoke deleteServiceId() with a valid options model and verify the result + Response response = iamIdentityService.deleteServiceId(deleteServiceIdOptionsModel).execute(); assertNotNull(response); Void responseObj = response.getResult(); assertNull(responseObj); @@ -502,46 +473,46 @@ public void testDeleteApiKeyWOptions() throws Throwable { assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteApiKeyPath); + assertEquals(parsedPath, deleteServiceIdPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteApiKey operation with and without retries enabled + // Test the deleteServiceId operation with and without retries enabled @Test - public void testDeleteApiKeyWRetries() throws Throwable { + public void testDeleteServiceIdWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteApiKeyWOptions(); + testDeleteServiceIdWOptions(); iamIdentityService.disableRetries(); - testDeleteApiKeyWOptions(); + testDeleteServiceIdWOptions(); } - // Test the deleteApiKey operation with a null options model (negative test) + // Test the deleteServiceId operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteApiKeyNoOptions() throws Throwable { + public void testDeleteServiceIdNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteApiKey(null).execute(); + iamIdentityService.deleteServiceId(null).execute(); } - // Test the lockApiKey operation with a valid options model parameter + // Test the lockServiceId operation with a valid options model parameter @Test - public void testLockApiKeyWOptions() throws Throwable { + public void testLockServiceIdWOptions() throws Throwable { // Register a mock response String mockResponseBody = ""; - String lockApiKeyPath = "/v1/apikeys/testString/lock"; + String lockServiceIdPath = "/v1/serviceids/testString/lock"; server.enqueue(new MockResponse() .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the LockApiKeyOptions model - LockApiKeyOptions lockApiKeyOptionsModel = new LockApiKeyOptions.Builder() + // Construct an instance of the LockServiceIdOptions model + LockServiceIdOptions lockServiceIdOptionsModel = new LockServiceIdOptions.Builder() .id("testString") .build(); - // Invoke lockApiKey() with a valid options model and verify the result - Response response = iamIdentityService.lockApiKey(lockApiKeyOptionsModel).execute(); + // Invoke lockServiceId() with a valid options model and verify the result + Response response = iamIdentityService.lockServiceId(lockServiceIdOptionsModel).execute(); assertNotNull(response); Void responseObj = response.getResult(); assertNull(responseObj); @@ -552,146 +523,46 @@ public void testLockApiKeyWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, lockApiKeyPath); + assertEquals(parsedPath, lockServiceIdPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the lockApiKey operation with and without retries enabled + // Test the lockServiceId operation with and without retries enabled @Test - public void testLockApiKeyWRetries() throws Throwable { + public void testLockServiceIdWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testLockApiKeyWOptions(); - - iamIdentityService.disableRetries(); - testLockApiKeyWOptions(); - } - - // Test the lockApiKey operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLockApiKeyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamIdentityService.lockApiKey(null).execute(); - } - - // Test the unlockApiKey operation with a valid options model parameter - @Test - public void testUnlockApiKeyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String unlockApiKeyPath = "/v1/apikeys/testString/lock"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the UnlockApiKeyOptions model - UnlockApiKeyOptions unlockApiKeyOptionsModel = new UnlockApiKeyOptions.Builder() - .id("testString") - .build(); - - // Invoke unlockApiKey() with a valid options model and verify the result - Response response = iamIdentityService.unlockApiKey(unlockApiKeyOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, unlockApiKeyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the unlockApiKey operation with and without retries enabled - @Test - public void testUnlockApiKeyWRetries() throws Throwable { - iamIdentityService.enableRetries(4, 30); - testUnlockApiKeyWOptions(); - - iamIdentityService.disableRetries(); - testUnlockApiKeyWOptions(); - } - - // Test the unlockApiKey operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUnlockApiKeyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamIdentityService.unlockApiKey(null).execute(); - } - - // Test the disableApiKey operation with a valid options model parameter - @Test - public void testDisableApiKeyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String disableApiKeyPath = "/v1/apikeys/testString/disable"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DisableApiKeyOptions model - DisableApiKeyOptions disableApiKeyOptionsModel = new DisableApiKeyOptions.Builder() - .id("testString") - .build(); - - // Invoke disableApiKey() with a valid options model and verify the result - Response response = iamIdentityService.disableApiKey(disableApiKeyOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, disableApiKeyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the disableApiKey operation with and without retries enabled - @Test - public void testDisableApiKeyWRetries() throws Throwable { - iamIdentityService.enableRetries(4, 30); - testDisableApiKeyWOptions(); + testLockServiceIdWOptions(); iamIdentityService.disableRetries(); - testDisableApiKeyWOptions(); + testLockServiceIdWOptions(); } - // Test the disableApiKey operation with a null options model (negative test) + // Test the lockServiceId operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDisableApiKeyNoOptions() throws Throwable { + public void testLockServiceIdNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.disableApiKey(null).execute(); + iamIdentityService.lockServiceId(null).execute(); } - // Test the enableApiKey operation with a valid options model parameter + // Test the unlockServiceId operation with a valid options model parameter @Test - public void testEnableApiKeyWOptions() throws Throwable { + public void testUnlockServiceIdWOptions() throws Throwable { // Register a mock response String mockResponseBody = ""; - String enableApiKeyPath = "/v1/apikeys/testString/disable"; + String unlockServiceIdPath = "/v1/serviceids/testString/lock"; server.enqueue(new MockResponse() .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the EnableApiKeyOptions model - EnableApiKeyOptions enableApiKeyOptionsModel = new EnableApiKeyOptions.Builder() + // Construct an instance of the UnlockServiceIdOptions model + UnlockServiceIdOptions unlockServiceIdOptionsModel = new UnlockServiceIdOptions.Builder() .id("testString") .build(); - // Invoke enableApiKey() with a valid options model and verify the result - Response response = iamIdentityService.enableApiKey(enableApiKeyOptionsModel).execute(); + // Invoke unlockServiceId() with a valid options model and verify the result + Response response = iamIdentityService.unlockServiceId(unlockServiceIdOptionsModel).execute(); assertNotNull(response); Void responseObj = response.getResult(); assertNull(responseObj); @@ -702,56 +573,49 @@ public void testEnableApiKeyWOptions() throws Throwable { assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, enableApiKeyPath); + assertEquals(parsedPath, unlockServiceIdPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the enableApiKey operation with and without retries enabled + // Test the unlockServiceId operation with and without retries enabled @Test - public void testEnableApiKeyWRetries() throws Throwable { + public void testUnlockServiceIdWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testEnableApiKeyWOptions(); + testUnlockServiceIdWOptions(); iamIdentityService.disableRetries(); - testEnableApiKeyWOptions(); + testUnlockServiceIdWOptions(); } - // Test the enableApiKey operation with a null options model (negative test) + // Test the unlockServiceId operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testEnableApiKeyNoOptions() throws Throwable { + public void testUnlockServiceIdNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.enableApiKey(null).execute(); + iamIdentityService.unlockServiceId(null).execute(); } - // Test the listServiceIds operation with a valid options model parameter + // Test the listServiceIdGroup operation with a valid options model parameter @Test - public void testListServiceIdsWOptions() throws Throwable { + public void testListServiceIdGroupWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"serviceids\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}]}"; - String listServiceIdsPath = "/v1/serviceids/"; + String mockResponseBody = "{\"serviceid_groups\": [{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"account_id\": \"accountId\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"createdAt\", \"created_by\": \"createdBy\", \"modified_at\": \"modifiedAt\"}]}"; + String listServiceIdGroupPath = "/v1/serviceid_groups"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListServiceIdsOptions model - ListServiceIdsOptions listServiceIdsOptionsModel = new ListServiceIdsOptions.Builder() + // Construct an instance of the ListServiceIdGroupOptions model + ListServiceIdGroupOptions listServiceIdGroupOptionsModel = new ListServiceIdGroupOptions.Builder() .accountId("testString") - .name("testString") - .pagesize(Long.valueOf("26")) - .pagetoken("testString") - .sort("testString") - .order("asc") - .includeHistory(false) - .filter("testString") .build(); - // Invoke listServiceIds() with a valid options model and verify the result - Response response = iamIdentityService.listServiceIds(listServiceIdsOptionsModel).execute(); + // Invoke listServiceIdGroup() with a valid options model and verify the result + Response response = iamIdentityService.listServiceIdGroup(listServiceIdGroupOptionsModel).execute(); assertNotNull(response); - ServiceIdList responseObj = response.getResult(); + ServiceIdGroupList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -760,63 +624,45 @@ public void testListServiceIdsWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listServiceIdsPath); + assertEquals(parsedPath, listServiceIdGroupPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(Long.valueOf(query.get("pagesize")), Long.valueOf("26")); - assertEquals(query.get("pagetoken"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("order"), "asc"); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); - assertEquals(query.get("filter"), "testString"); } - // Test the listServiceIds operation with and without retries enabled + // Test the listServiceIdGroup operation with and without retries enabled @Test - public void testListServiceIdsWRetries() throws Throwable { + public void testListServiceIdGroupWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListServiceIdsWOptions(); + testListServiceIdGroupWOptions(); iamIdentityService.disableRetries(); - testListServiceIdsWOptions(); + testListServiceIdGroupWOptions(); } - // Test the createServiceId operation with a valid options model parameter + // Test the createServiceIdGroup operation with a valid options model parameter @Test - public void testCreateServiceIdWOptions() throws Throwable { + public void testCreateServiceIdGroupWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String createServiceIdPath = "/v1/serviceids/"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"account_id\": \"accountId\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"createdAt\", \"created_by\": \"createdBy\", \"modified_at\": \"modifiedAt\"}"; + String createServiceIdGroupPath = "/v1/serviceid_groups"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the ApiKeyInsideCreateServiceIdRequest model - ApiKeyInsideCreateServiceIdRequest apiKeyInsideCreateServiceIdRequestModel = new ApiKeyInsideCreateServiceIdRequest.Builder() - .name("testString") - .description("testString") - .apikey("testString") - .storeValue(true) - .build(); - - // Construct an instance of the CreateServiceIdOptions model - CreateServiceIdOptions createServiceIdOptionsModel = new CreateServiceIdOptions.Builder() + // Construct an instance of the CreateServiceIdGroupOptions model + CreateServiceIdGroupOptions createServiceIdGroupOptionsModel = new CreateServiceIdGroupOptions.Builder() .accountId("testString") .name("testString") .description("testString") - .uniqueInstanceCrns(java.util.Arrays.asList("testString")) - .apikey(apiKeyInsideCreateServiceIdRequestModel) - .entityLock("false") .build(); - // Invoke createServiceId() with a valid options model and verify the result - Response response = iamIdentityService.createServiceId(createServiceIdOptionsModel).execute(); + // Invoke createServiceIdGroup() with a valid options model and verify the result + Response response = iamIdentityService.createServiceIdGroup(createServiceIdGroupOptionsModel).execute(); assertNotNull(response); - ServiceId responseObj = response.getResult(); + ServiceIdGroup responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -825,51 +671,49 @@ public void testCreateServiceIdWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createServiceIdPath); + assertEquals(parsedPath, createServiceIdGroupPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createServiceId operation with and without retries enabled + // Test the createServiceIdGroup operation with and without retries enabled @Test - public void testCreateServiceIdWRetries() throws Throwable { + public void testCreateServiceIdGroupWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateServiceIdWOptions(); + testCreateServiceIdGroupWOptions(); iamIdentityService.disableRetries(); - testCreateServiceIdWOptions(); + testCreateServiceIdGroupWOptions(); } - // Test the createServiceId operation with a null options model (negative test) + // Test the createServiceIdGroup operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateServiceIdNoOptions() throws Throwable { + public void testCreateServiceIdGroupNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createServiceId(null).execute(); + iamIdentityService.createServiceIdGroup(null).execute(); } - // Test the getServiceId operation with a valid options model parameter + // Test the getServiceIdGroup operation with a valid options model parameter @Test - public void testGetServiceIdWOptions() throws Throwable { + public void testGetServiceIdGroupWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String getServiceIdPath = "/v1/serviceids/testString"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"account_id\": \"accountId\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"createdAt\", \"created_by\": \"createdBy\", \"modified_at\": \"modifiedAt\"}"; + String getServiceIdGroupPath = "/v1/serviceid_groups/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetServiceIdOptions model - GetServiceIdOptions getServiceIdOptionsModel = new GetServiceIdOptions.Builder() + // Construct an instance of the GetServiceIdGroupOptions model + GetServiceIdGroupOptions getServiceIdGroupOptionsModel = new GetServiceIdGroupOptions.Builder() .id("testString") - .includeHistory(false) - .includeActivity(false) .build(); - // Invoke getServiceId() with a valid options model and verify the result - Response response = iamIdentityService.getServiceId(getServiceIdOptionsModel).execute(); + // Invoke getServiceIdGroup() with a valid options model and verify the result + Response response = iamIdentityService.getServiceIdGroup(getServiceIdGroupOptionsModel).execute(); assertNotNull(response); - ServiceId responseObj = response.getResult(); + ServiceIdGroup responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -878,55 +722,52 @@ public void testGetServiceIdWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getServiceIdPath); - // Verify query params + assertEquals(parsedPath, getServiceIdGroupPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); - assertEquals(Boolean.valueOf(query.get("include_activity")), Boolean.valueOf(false)); + assertNull(query); } - // Test the getServiceId operation with and without retries enabled + // Test the getServiceIdGroup operation with and without retries enabled @Test - public void testGetServiceIdWRetries() throws Throwable { + public void testGetServiceIdGroupWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetServiceIdWOptions(); + testGetServiceIdGroupWOptions(); iamIdentityService.disableRetries(); - testGetServiceIdWOptions(); + testGetServiceIdGroupWOptions(); } - // Test the getServiceId operation with a null options model (negative test) + // Test the getServiceIdGroup operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetServiceIdNoOptions() throws Throwable { + public void testGetServiceIdGroupNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getServiceId(null).execute(); + iamIdentityService.getServiceIdGroup(null).execute(); } - // Test the updateServiceId operation with a valid options model parameter + // Test the updateServiceIdGroup operation with a valid options model parameter @Test - public void testUpdateServiceIdWOptions() throws Throwable { + public void testUpdateServiceIdGroupWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"iam_id\": \"iamId\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"unique_instance_crns\": [\"uniqueInstanceCrns\"], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"apikey\": {\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}, \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String updateServiceIdPath = "/v1/serviceids/testString"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"account_id\": \"accountId\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"createdAt\", \"created_by\": \"createdBy\", \"modified_at\": \"modifiedAt\"}"; + String updateServiceIdGroupPath = "/v1/serviceid_groups/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the UpdateServiceIdOptions model - UpdateServiceIdOptions updateServiceIdOptionsModel = new UpdateServiceIdOptions.Builder() + // Construct an instance of the UpdateServiceIdGroupOptions model + UpdateServiceIdGroupOptions updateServiceIdGroupOptionsModel = new UpdateServiceIdGroupOptions.Builder() .id("testString") .ifMatch("testString") .name("testString") .description("testString") - .uniqueInstanceCrns(java.util.Arrays.asList("testString")) .build(); - // Invoke updateServiceId() with a valid options model and verify the result - Response response = iamIdentityService.updateServiceId(updateServiceIdOptionsModel).execute(); + // Invoke updateServiceIdGroup() with a valid options model and verify the result + Response response = iamIdentityService.updateServiceIdGroup(updateServiceIdGroupOptionsModel).execute(); assertNotNull(response); - ServiceId responseObj = response.getResult(); + ServiceIdGroup responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -935,7 +776,7 @@ public void testUpdateServiceIdWOptions() throws Throwable { assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateServiceIdPath); + assertEquals(parsedPath, updateServiceIdGroupPath); // Verify header parameters assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string @@ -943,40 +784,40 @@ public void testUpdateServiceIdWOptions() throws Throwable { assertNull(query); } - // Test the updateServiceId operation with and without retries enabled + // Test the updateServiceIdGroup operation with and without retries enabled @Test - public void testUpdateServiceIdWRetries() throws Throwable { + public void testUpdateServiceIdGroupWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateServiceIdWOptions(); + testUpdateServiceIdGroupWOptions(); iamIdentityService.disableRetries(); - testUpdateServiceIdWOptions(); + testUpdateServiceIdGroupWOptions(); } - // Test the updateServiceId operation with a null options model (negative test) + // Test the updateServiceIdGroup operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateServiceIdNoOptions() throws Throwable { + public void testUpdateServiceIdGroupNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateServiceId(null).execute(); + iamIdentityService.updateServiceIdGroup(null).execute(); } - // Test the deleteServiceId operation with a valid options model parameter + // Test the deleteServiceIdGroup operation with a valid options model parameter @Test - public void testDeleteServiceIdWOptions() throws Throwable { + public void testDeleteServiceIdGroupWOptions() throws Throwable { // Register a mock response String mockResponseBody = ""; - String deleteServiceIdPath = "/v1/serviceids/testString"; + String deleteServiceIdGroupPath = "/v1/serviceid_groups/testString"; server.enqueue(new MockResponse() .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the DeleteServiceIdOptions model - DeleteServiceIdOptions deleteServiceIdOptionsModel = new DeleteServiceIdOptions.Builder() + // Construct an instance of the DeleteServiceIdGroupOptions model + DeleteServiceIdGroupOptions deleteServiceIdGroupOptionsModel = new DeleteServiceIdGroupOptions.Builder() .id("testString") .build(); - // Invoke deleteServiceId() with a valid options model and verify the result - Response response = iamIdentityService.deleteServiceId(deleteServiceIdOptionsModel).execute(); + // Invoke deleteServiceIdGroup() with a valid options model and verify the result + Response response = iamIdentityService.deleteServiceIdGroup(deleteServiceIdGroupOptionsModel).execute(); assertNotNull(response); Void responseObj = response.getResult(); assertNull(responseObj); @@ -987,209 +828,222 @@ public void testDeleteServiceIdWOptions() throws Throwable { assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteServiceIdPath); + assertEquals(parsedPath, deleteServiceIdGroupPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteServiceId operation with and without retries enabled + // Test the deleteServiceIdGroup operation with and without retries enabled @Test - public void testDeleteServiceIdWRetries() throws Throwable { + public void testDeleteServiceIdGroupWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteServiceIdWOptions(); + testDeleteServiceIdGroupWOptions(); iamIdentityService.disableRetries(); - testDeleteServiceIdWOptions(); + testDeleteServiceIdGroupWOptions(); } - // Test the deleteServiceId operation with a null options model (negative test) + // Test the deleteServiceIdGroup operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteServiceIdNoOptions() throws Throwable { + public void testDeleteServiceIdGroupNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteServiceId(null).execute(); + iamIdentityService.deleteServiceIdGroup(null).execute(); } - // Test the lockServiceId operation with a valid options model parameter + // Test the listApiKeys operation with a valid options model parameter @Test - public void testLockServiceIdWOptions() throws Throwable { + public void testListApiKeysWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String lockServiceIdPath = "/v1/serviceids/testString/lock"; - server.enqueue(new MockResponse() - .setResponseCode(204) + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"apikeys\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}]}"; + String listApiKeysPath = "/v1/apikeys"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the LockServiceIdOptions model - LockServiceIdOptions lockServiceIdOptionsModel = new LockServiceIdOptions.Builder() - .id("testString") + // Construct an instance of the ListApiKeysOptions model + ListApiKeysOptions listApiKeysOptionsModel = new ListApiKeysOptions.Builder() + .accountId("testString") + .iamId("testString") + .pagesize(Long.valueOf("26")) + .pagetoken("testString") + .scope("entity") + .type("user") + .sort("testString") + .order("asc") + .includeHistory(false) + .filter("testString") + .groupId("testString") .build(); - // Invoke lockServiceId() with a valid options model and verify the result - Response response = iamIdentityService.lockServiceId(lockServiceIdOptionsModel).execute(); + // Invoke listApiKeys() with a valid options model and verify the result + Response response = iamIdentityService.listApiKeys(listApiKeysOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + ApiKeyList responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, lockServiceIdPath); - // Verify that there is no query string + assertEquals(parsedPath, listApiKeysPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("iam_id"), "testString"); + assertEquals(Long.valueOf(query.get("pagesize")), Long.valueOf("26")); + assertEquals(query.get("pagetoken"), "testString"); + assertEquals(query.get("scope"), "entity"); + assertEquals(query.get("type"), "user"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("order"), "asc"); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertEquals(query.get("filter"), "testString"); + assertEquals(query.get("group_id"), "testString"); } - // Test the lockServiceId operation with and without retries enabled + // Test the listApiKeys operation with and without retries enabled @Test - public void testLockServiceIdWRetries() throws Throwable { + public void testListApiKeysWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testLockServiceIdWOptions(); + testListApiKeysWOptions(); iamIdentityService.disableRetries(); - testLockServiceIdWOptions(); - } - - // Test the lockServiceId operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLockServiceIdNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamIdentityService.lockServiceId(null).execute(); + testListApiKeysWOptions(); } - // Test the unlockServiceId operation with a valid options model parameter + // Test the createApiKey operation with a valid options model parameter @Test - public void testUnlockServiceIdWOptions() throws Throwable { + public void testCreateApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String unlockServiceIdPath = "/v1/serviceids/testString/lock"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String createApiKeyPath = "/v1/apikeys"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the UnlockServiceIdOptions model - UnlockServiceIdOptions unlockServiceIdOptionsModel = new UnlockServiceIdOptions.Builder() - .id("testString") + // Construct an instance of the CreateApiKeyOptions model + CreateApiKeyOptions createApiKeyOptionsModel = new CreateApiKeyOptions.Builder() + .name("testString") + .iamId("testString") + .description("testString") + .accountId("testString") + .apikey("testString") + .storeValue(true) + .supportSessions(true) + .actionWhenLeaked("testString") + .entityLock("false") + .entityDisable("false") .build(); - // Invoke unlockServiceId() with a valid options model and verify the result - Response response = iamIdentityService.unlockServiceId(unlockServiceIdOptionsModel).execute(); + // Invoke createApiKey() with a valid options model and verify the result + Response response = iamIdentityService.createApiKey(createApiKeyOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + ApiKey responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, unlockServiceIdPath); + assertEquals(parsedPath, createApiKeyPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the unlockServiceId operation with and without retries enabled + // Test the createApiKey operation with and without retries enabled @Test - public void testUnlockServiceIdWRetries() throws Throwable { + public void testCreateApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUnlockServiceIdWOptions(); + testCreateApiKeyWOptions(); iamIdentityService.disableRetries(); - testUnlockServiceIdWOptions(); + testCreateApiKeyWOptions(); } - // Test the unlockServiceId operation with a null options model (negative test) + // Test the createApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUnlockServiceIdNoOptions() throws Throwable { + public void testCreateApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.unlockServiceId(null).execute(); + iamIdentityService.createApiKey(null).execute(); } - // Test the createProfile operation with a valid options model parameter + // Test the getApiKeysDetails operation with a valid options model parameter @Test - public void testCreateProfileWOptions() throws Throwable { + public void testGetApiKeysDetailsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String createProfilePath = "/v1/profiles"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String getApiKeysDetailsPath = "/v1/apikeys/details"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CreateProfileOptions model - CreateProfileOptions createProfileOptionsModel = new CreateProfileOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") + // Construct an instance of the GetApiKeysDetailsOptions model + GetApiKeysDetailsOptions getApiKeysDetailsOptionsModel = new GetApiKeysDetailsOptions.Builder() + .iamApiKey("testString") + .includeHistory(false) .build(); - // Invoke createProfile() with a valid options model and verify the result - Response response = iamIdentityService.createProfile(createProfileOptionsModel).execute(); + // Invoke getApiKeysDetails() with a valid options model and verify the result + Response response = iamIdentityService.getApiKeysDetails(getApiKeysDetailsOptionsModel).execute(); assertNotNull(response); - TrustedProfile responseObj = response.getResult(); + ApiKey responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createProfilePath); - // Verify that there is no query string + assertEquals(parsedPath, getApiKeysDetailsPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); } - // Test the createProfile operation with and without retries enabled + // Test the getApiKeysDetails operation with and without retries enabled @Test - public void testCreateProfileWRetries() throws Throwable { + public void testGetApiKeysDetailsWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateProfileWOptions(); + testGetApiKeysDetailsWOptions(); iamIdentityService.disableRetries(); - testCreateProfileWOptions(); - } - - // Test the createProfile operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateProfileNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamIdentityService.createProfile(null).execute(); + testGetApiKeysDetailsWOptions(); } - // Test the listProfiles operation with a valid options model parameter + // Test the getApiKey operation with a valid options model parameter @Test - public void testListProfilesWOptions() throws Throwable { + public void testGetApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"profiles\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}]}"; - String listProfilesPath = "/v1/profiles"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String getApiKeyPath = "/v1/apikeys/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListProfilesOptions model - ListProfilesOptions listProfilesOptionsModel = new ListProfilesOptions.Builder() - .accountId("testString") - .name("testString") - .pagesize(Long.valueOf("26")) - .sort("testString") - .order("asc") + // Construct an instance of the GetApiKeyOptions model + GetApiKeyOptions getApiKeyOptionsModel = new GetApiKeyOptions.Builder() + .id("testString") .includeHistory(false) - .pagetoken("testString") - .filter("testString") + .includeActivity(false) .build(); - // Invoke listProfiles() with a valid options model and verify the result - Response response = iamIdentityService.listProfiles(listProfilesOptionsModel).execute(); + // Invoke getApiKey() with a valid options model and verify the result + Response response = iamIdentityService.getApiKey(getApiKeyOptionsModel).execute(); assertNotNull(response); - TrustedProfilesList responseObj = response.getResult(); + ApiKey responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1198,163 +1052,156 @@ public void testListProfilesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProfilesPath); + assertEquals(parsedPath, getApiKeyPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(Long.valueOf(query.get("pagesize")), Long.valueOf("26")); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("order"), "asc"); assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); - assertEquals(query.get("pagetoken"), "testString"); - assertEquals(query.get("filter"), "testString"); + assertEquals(Boolean.valueOf(query.get("include_activity")), Boolean.valueOf(false)); } - // Test the listProfiles operation with and without retries enabled + // Test the getApiKey operation with and without retries enabled @Test - public void testListProfilesWRetries() throws Throwable { + public void testGetApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListProfilesWOptions(); + testGetApiKeyWOptions(); iamIdentityService.disableRetries(); - testListProfilesWOptions(); + testGetApiKeyWOptions(); } - // Test the listProfiles operation with a null options model (negative test) + // Test the getApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListProfilesNoOptions() throws Throwable { + public void testGetApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.listProfiles(null).execute(); + iamIdentityService.getApiKey(null).execute(); } - // Test the getProfile operation with a valid options model parameter + // Test the updateApiKey operation with a valid options model parameter @Test - public void testGetProfileWOptions() throws Throwable { + public void testUpdateApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String getProfilePath = "/v1/profiles/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"locked\": true, \"disabled\": true, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"support_sessions\": false, \"action_when_leaked\": \"actionWhenLeaked\", \"description\": \"description\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"apikey\": \"apikey\", \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String updateApiKeyPath = "/v1/apikeys/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetProfileOptions model - GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() - .profileId("testString") - .includeActivity(false) + // Construct an instance of the UpdateApiKeyOptions model + UpdateApiKeyOptions updateApiKeyOptionsModel = new UpdateApiKeyOptions.Builder() + .id("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .supportSessions(true) + .actionWhenLeaked("testString") .build(); - // Invoke getProfile() with a valid options model and verify the result - Response response = iamIdentityService.getProfile(getProfileOptionsModel).execute(); + // Invoke updateApiKey() with a valid options model and verify the result + Response response = iamIdentityService.updateApiKey(updateApiKeyOptionsModel).execute(); assertNotNull(response); - TrustedProfile responseObj = response.getResult(); + ApiKey responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProfilePath); - // Verify query params + assertEquals(parsedPath, updateApiKeyPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_activity")), Boolean.valueOf(false)); + assertNull(query); } - // Test the getProfile operation with and without retries enabled + // Test the updateApiKey operation with and without retries enabled @Test - public void testGetProfileWRetries() throws Throwable { + public void testUpdateApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetProfileWOptions(); + testUpdateApiKeyWOptions(); iamIdentityService.disableRetries(); - testGetProfileWOptions(); + testUpdateApiKeyWOptions(); } - // Test the getProfile operation with a null options model (negative test) + // Test the updateApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProfileNoOptions() throws Throwable { + public void testUpdateApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getProfile(null).execute(); + iamIdentityService.updateApiKey(null).execute(); } - // Test the updateProfile operation with a valid options model parameter + // Test the deleteApiKey operation with a valid options model parameter @Test - public void testUpdateProfileWOptions() throws Throwable { + public void testDeleteApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; - String updateProfilePath = "/v1/profiles/testString"; + String mockResponseBody = ""; + String deleteApiKeyPath = "/v1/apikeys/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the UpdateProfileOptions model - UpdateProfileOptions updateProfileOptionsModel = new UpdateProfileOptions.Builder() - .profileId("testString") - .ifMatch("testString") - .name("testString") - .description("testString") + // Construct an instance of the DeleteApiKeyOptions model + DeleteApiKeyOptions deleteApiKeyOptionsModel = new DeleteApiKeyOptions.Builder() + .id("testString") .build(); - // Invoke updateProfile() with a valid options model and verify the result - Response response = iamIdentityService.updateProfile(updateProfileOptionsModel).execute(); + // Invoke deleteApiKey() with a valid options model and verify the result + Response response = iamIdentityService.deleteApiKey(deleteApiKeyOptionsModel).execute(); assertNotNull(response); - TrustedProfile responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateProfilePath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, deleteApiKeyPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updateProfile operation with and without retries enabled + // Test the deleteApiKey operation with and without retries enabled @Test - public void testUpdateProfileWRetries() throws Throwable { + public void testDeleteApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateProfileWOptions(); + testDeleteApiKeyWOptions(); iamIdentityService.disableRetries(); - testUpdateProfileWOptions(); + testDeleteApiKeyWOptions(); } - // Test the updateProfile operation with a null options model (negative test) + // Test the deleteApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateProfileNoOptions() throws Throwable { + public void testDeleteApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateProfile(null).execute(); + iamIdentityService.deleteApiKey(null).execute(); } - // Test the deleteProfile operation with a valid options model parameter + // Test the lockApiKey operation with a valid options model parameter @Test - public void testDeleteProfileWOptions() throws Throwable { + public void testLockApiKeyWOptions() throws Throwable { // Register a mock response String mockResponseBody = ""; - String deleteProfilePath = "/v1/profiles/testString"; + String lockApiKeyPath = "/v1/apikeys/testString/lock"; server.enqueue(new MockResponse() .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the DeleteProfileOptions model - DeleteProfileOptions deleteProfileOptionsModel = new DeleteProfileOptions.Builder() - .profileId("testString") + // Construct an instance of the LockApiKeyOptions model + LockApiKeyOptions lockApiKeyOptionsModel = new LockApiKeyOptions.Builder() + .id("testString") .build(); - // Invoke deleteProfile() with a valid options model and verify the result - Response response = iamIdentityService.deleteProfile(deleteProfileOptionsModel).execute(); + // Invoke lockApiKey() with a valid options model and verify the result + Response response = iamIdentityService.lockApiKey(lockApiKeyOptionsModel).execute(); assertNotNull(response); Void responseObj = response.getResult(); assertNull(responseObj); @@ -1362,585 +1209,562 @@ public void testDeleteProfileWOptions() throws Throwable { // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteProfilePath); + assertEquals(parsedPath, lockApiKeyPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteProfile operation with and without retries enabled + // Test the lockApiKey operation with and without retries enabled @Test - public void testDeleteProfileWRetries() throws Throwable { + public void testLockApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteProfileWOptions(); + testLockApiKeyWOptions(); iamIdentityService.disableRetries(); - testDeleteProfileWOptions(); + testLockApiKeyWOptions(); } - // Test the deleteProfile operation with a null options model (negative test) + // Test the lockApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteProfileNoOptions() throws Throwable { + public void testLockApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteProfile(null).execute(); + iamIdentityService.lockApiKey(null).execute(); } - // Test the createClaimRule operation with a valid options model parameter + // Test the unlockApiKey operation with a valid options model parameter @Test - public void testCreateClaimRuleWOptions() throws Throwable { + public void testUnlockApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}"; - String createClaimRulePath = "/v1/profiles/testString/rules"; + String mockResponseBody = ""; + String unlockApiKeyPath = "/v1/apikeys/testString/lock"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the ProfileClaimRuleConditions model - ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() - .claim("testString") - .operator("testString") - .value("testString") - .build(); - - // Construct an instance of the ResponseContext model - ResponseContext responseContextModel = new ResponseContext.Builder() - .transactionId("testString") - .operation("testString") - .userAgent("testString") - .url("testString") - .instanceId("testString") - .threadId("testString") - .host("testString") - .startTime("testString") - .endTime("testString") - .elapsedTime("testString") - .clusterName("testString") - .build(); - - // Construct an instance of the CreateClaimRuleOptions model - CreateClaimRuleOptions createClaimRuleOptionsModel = new CreateClaimRuleOptions.Builder() - .profileId("testString") - .type("testString") - .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) - .context(responseContextModel) - .name("testString") - .realmName("testString") - .crType("testString") - .expiration(Long.valueOf("26")) + // Construct an instance of the UnlockApiKeyOptions model + UnlockApiKeyOptions unlockApiKeyOptionsModel = new UnlockApiKeyOptions.Builder() + .id("testString") .build(); - // Invoke createClaimRule() with a valid options model and verify the result - Response response = iamIdentityService.createClaimRule(createClaimRuleOptionsModel).execute(); + // Invoke unlockApiKey() with a valid options model and verify the result + Response response = iamIdentityService.unlockApiKey(unlockApiKeyOptionsModel).execute(); assertNotNull(response); - ProfileClaimRule responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createClaimRulePath); + assertEquals(parsedPath, unlockApiKeyPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createClaimRule operation with and without retries enabled + // Test the unlockApiKey operation with and without retries enabled @Test - public void testCreateClaimRuleWRetries() throws Throwable { + public void testUnlockApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateClaimRuleWOptions(); + testUnlockApiKeyWOptions(); iamIdentityService.disableRetries(); - testCreateClaimRuleWOptions(); + testUnlockApiKeyWOptions(); } - // Test the createClaimRule operation with a null options model (negative test) + // Test the unlockApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateClaimRuleNoOptions() throws Throwable { + public void testUnlockApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createClaimRule(null).execute(); + iamIdentityService.unlockApiKey(null).execute(); } - // Test the listClaimRules operation with a valid options model parameter + // Test the disableApiKey operation with a valid options model parameter @Test - public void testListClaimRulesWOptions() throws Throwable { + public void testDisableApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"rules\": [{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}]}"; - String listClaimRulesPath = "/v1/profiles/testString/rules"; + String mockResponseBody = ""; + String disableApiKeyPath = "/v1/apikeys/testString/disable"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the ListClaimRulesOptions model - ListClaimRulesOptions listClaimRulesOptionsModel = new ListClaimRulesOptions.Builder() - .profileId("testString") + // Construct an instance of the DisableApiKeyOptions model + DisableApiKeyOptions disableApiKeyOptionsModel = new DisableApiKeyOptions.Builder() + .id("testString") .build(); - // Invoke listClaimRules() with a valid options model and verify the result - Response response = iamIdentityService.listClaimRules(listClaimRulesOptionsModel).execute(); + // Invoke disableApiKey() with a valid options model and verify the result + Response response = iamIdentityService.disableApiKey(disableApiKeyOptionsModel).execute(); assertNotNull(response); - ProfileClaimRuleList responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listClaimRulesPath); + assertEquals(parsedPath, disableApiKeyPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the listClaimRules operation with and without retries enabled + // Test the disableApiKey operation with and without retries enabled @Test - public void testListClaimRulesWRetries() throws Throwable { + public void testDisableApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListClaimRulesWOptions(); + testDisableApiKeyWOptions(); iamIdentityService.disableRetries(); - testListClaimRulesWOptions(); + testDisableApiKeyWOptions(); } - // Test the listClaimRules operation with a null options model (negative test) + // Test the disableApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListClaimRulesNoOptions() throws Throwable { + public void testDisableApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.listClaimRules(null).execute(); + iamIdentityService.disableApiKey(null).execute(); } - // Test the getClaimRule operation with a valid options model parameter + // Test the enableApiKey operation with a valid options model parameter @Test - public void testGetClaimRuleWOptions() throws Throwable { + public void testEnableApiKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}"; - String getClaimRulePath = "/v1/profiles/testString/rules/testString"; + String mockResponseBody = ""; + String enableApiKeyPath = "/v1/apikeys/testString/disable"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the GetClaimRuleOptions model - GetClaimRuleOptions getClaimRuleOptionsModel = new GetClaimRuleOptions.Builder() - .profileId("testString") - .ruleId("testString") + // Construct an instance of the EnableApiKeyOptions model + EnableApiKeyOptions enableApiKeyOptionsModel = new EnableApiKeyOptions.Builder() + .id("testString") .build(); - // Invoke getClaimRule() with a valid options model and verify the result - Response response = iamIdentityService.getClaimRule(getClaimRuleOptionsModel).execute(); + // Invoke enableApiKey() with a valid options model and verify the result + Response response = iamIdentityService.enableApiKey(enableApiKeyOptionsModel).execute(); assertNotNull(response); - ProfileClaimRule responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getClaimRulePath); + assertEquals(parsedPath, enableApiKeyPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getClaimRule operation with and without retries enabled + // Test the enableApiKey operation with and without retries enabled @Test - public void testGetClaimRuleWRetries() throws Throwable { + public void testEnableApiKeyWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetClaimRuleWOptions(); + testEnableApiKeyWOptions(); iamIdentityService.disableRetries(); - testGetClaimRuleWOptions(); + testEnableApiKeyWOptions(); } - // Test the getClaimRule operation with a null options model (negative test) + // Test the enableApiKey operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetClaimRuleNoOptions() throws Throwable { + public void testEnableApiKeyNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getClaimRule(null).execute(); + iamIdentityService.enableApiKey(null).execute(); } - // Test the updateClaimRule operation with a valid options model parameter + // Test the createProfile operation with a valid options model parameter @Test - public void testUpdateClaimRuleWOptions() throws Throwable { + public void testCreateProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}"; - String updateClaimRulePath = "/v1/profiles/testString/rules/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"email\": \"email\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String createProfilePath = "/v1/profiles"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the ProfileClaimRuleConditions model - ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() - .claim("testString") - .operator("testString") - .value("testString") - .build(); - - // Construct an instance of the ResponseContext model - ResponseContext responseContextModel = new ResponseContext.Builder() - .transactionId("testString") - .operation("testString") - .userAgent("testString") - .url("testString") - .instanceId("testString") - .threadId("testString") - .host("testString") - .startTime("testString") - .endTime("testString") - .elapsedTime("testString") - .clusterName("testString") - .build(); - - // Construct an instance of the UpdateClaimRuleOptions model - UpdateClaimRuleOptions updateClaimRuleOptionsModel = new UpdateClaimRuleOptions.Builder() - .profileId("testString") - .ruleId("testString") - .ifMatch("testString") - .type("testString") - .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) - .context(responseContextModel) + // Construct an instance of the CreateProfileOptions model + CreateProfileOptions createProfileOptionsModel = new CreateProfileOptions.Builder() .name("testString") - .realmName("testString") - .crType("testString") - .expiration(Long.valueOf("26")) + .accountId("testString") + .description("testString") + .email("testString") .build(); - // Invoke updateClaimRule() with a valid options model and verify the result - Response response = iamIdentityService.updateClaimRule(updateClaimRuleOptionsModel).execute(); + // Invoke createProfile() with a valid options model and verify the result + Response response = iamIdentityService.createProfile(createProfileOptionsModel).execute(); assertNotNull(response); - ProfileClaimRule responseObj = response.getResult(); + TrustedProfile responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateClaimRulePath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, createProfilePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updateClaimRule operation with and without retries enabled + // Test the createProfile operation with and without retries enabled @Test - public void testUpdateClaimRuleWRetries() throws Throwable { + public void testCreateProfileWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateClaimRuleWOptions(); + testCreateProfileWOptions(); iamIdentityService.disableRetries(); - testUpdateClaimRuleWOptions(); + testCreateProfileWOptions(); } - // Test the updateClaimRule operation with a null options model (negative test) + // Test the createProfile operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateClaimRuleNoOptions() throws Throwable { + public void testCreateProfileNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateClaimRule(null).execute(); + iamIdentityService.createProfile(null).execute(); } - // Test the deleteClaimRule operation with a valid options model parameter + // Test the listProfiles operation with a valid options model parameter @Test - public void testDeleteClaimRuleWOptions() throws Throwable { + public void testListProfilesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteClaimRulePath = "/v1/profiles/testString/rules/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"profiles\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"email\": \"email\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}]}"; + String listProfilesPath = "/v1/profiles"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteClaimRuleOptions model - DeleteClaimRuleOptions deleteClaimRuleOptionsModel = new DeleteClaimRuleOptions.Builder() - .profileId("testString") - .ruleId("testString") + // Construct an instance of the ListProfilesOptions model + ListProfilesOptions listProfilesOptionsModel = new ListProfilesOptions.Builder() + .accountId("testString") + .name("testString") + .pagesize(Long.valueOf("26")) + .sort("testString") + .order("asc") + .includeHistory(false) + .pagetoken("testString") + .filter("testString") .build(); - // Invoke deleteClaimRule() with a valid options model and verify the result - Response response = iamIdentityService.deleteClaimRule(deleteClaimRuleOptionsModel).execute(); + // Invoke listProfiles() with a valid options model and verify the result + Response response = iamIdentityService.listProfiles(listProfilesOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + TrustedProfilesList responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteClaimRulePath); - // Verify that there is no query string + assertEquals(parsedPath, listProfilesPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(Long.valueOf(query.get("pagesize")), Long.valueOf("26")); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("order"), "asc"); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertEquals(query.get("pagetoken"), "testString"); + assertEquals(query.get("filter"), "testString"); } - // Test the deleteClaimRule operation with and without retries enabled + // Test the listProfiles operation with and without retries enabled @Test - public void testDeleteClaimRuleWRetries() throws Throwable { + public void testListProfilesWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteClaimRuleWOptions(); + testListProfilesWOptions(); iamIdentityService.disableRetries(); - testDeleteClaimRuleWOptions(); + testListProfilesWOptions(); } - // Test the deleteClaimRule operation with a null options model (negative test) + // Test the listProfiles operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteClaimRuleNoOptions() throws Throwable { + public void testListProfilesNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteClaimRule(null).execute(); + iamIdentityService.listProfiles(null).execute(); } - // Test the createLink operation with a valid options model parameter + // Test the getProfile operation with a valid options model parameter @Test - public void testCreateLinkWOptions() throws Throwable { + public void testGetProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"cr_type\": \"crType\", \"link\": {\"crn\": \"crn\", \"namespace\": \"namespace\", \"name\": \"name\"}}"; - String createLinkPath = "/v1/profiles/testString/links"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"email\": \"email\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String getProfilePath = "/v1/profiles/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CreateProfileLinkRequestLink model - CreateProfileLinkRequestLink createProfileLinkRequestLinkModel = new CreateProfileLinkRequestLink.Builder() - .crn("testString") - .namespace("testString") - .name("testString") - .build(); - - // Construct an instance of the CreateLinkOptions model - CreateLinkOptions createLinkOptionsModel = new CreateLinkOptions.Builder() + // Construct an instance of the GetProfileOptions model + GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() .profileId("testString") - .crType("testString") - .link(createProfileLinkRequestLinkModel) - .name("testString") + .includeActivity(false) .build(); - // Invoke createLink() with a valid options model and verify the result - Response response = iamIdentityService.createLink(createLinkOptionsModel).execute(); + // Invoke getProfile() with a valid options model and verify the result + Response response = iamIdentityService.getProfile(getProfileOptionsModel).execute(); assertNotNull(response); - ProfileLink responseObj = response.getResult(); + TrustedProfile responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createLinkPath); - // Verify that there is no query string + assertEquals(parsedPath, getProfilePath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(Boolean.valueOf(query.get("include_activity")), Boolean.valueOf(false)); } - // Test the createLink operation with and without retries enabled + // Test the getProfile operation with and without retries enabled @Test - public void testCreateLinkWRetries() throws Throwable { + public void testGetProfileWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateLinkWOptions(); + testGetProfileWOptions(); iamIdentityService.disableRetries(); - testCreateLinkWOptions(); + testGetProfileWOptions(); } - // Test the createLink operation with a null options model (negative test) + // Test the getProfile operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateLinkNoOptions() throws Throwable { + public void testGetProfileNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createLink(null).execute(); + iamIdentityService.getProfile(null).execute(); } - // Test the listLinks operation with a valid options model parameter + // Test the updateProfile operation with a valid options model parameter @Test - public void testListLinksWOptions() throws Throwable { + public void testUpdateProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"links\": [{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"cr_type\": \"crType\", \"link\": {\"crn\": \"crn\", \"namespace\": \"namespace\", \"name\": \"name\"}}]}"; - String listLinksPath = "/v1/profiles/testString/links"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"name\": \"name\", \"description\": \"description\", \"email\": \"email\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"iam_id\": \"iamId\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"assignment_id\": \"assignmentId\", \"ims_account_id\": 12, \"ims_user_id\": 9, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"activity\": {\"last_authn\": \"lastAuthn\", \"authn_count\": 10}}"; + String updateProfilePath = "/v1/profiles/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListLinksOptions model - ListLinksOptions listLinksOptionsModel = new ListLinksOptions.Builder() + // Construct an instance of the UpdateProfileOptions model + UpdateProfileOptions updateProfileOptionsModel = new UpdateProfileOptions.Builder() .profileId("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .email("testString") .build(); - // Invoke listLinks() with a valid options model and verify the result - Response response = iamIdentityService.listLinks(listLinksOptionsModel).execute(); + // Invoke updateProfile() with a valid options model and verify the result + Response response = iamIdentityService.updateProfile(updateProfileOptionsModel).execute(); assertNotNull(response); - ProfileLinkList responseObj = response.getResult(); + TrustedProfile responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listLinksPath); + assertEquals(parsedPath, updateProfilePath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the listLinks operation with and without retries enabled + // Test the updateProfile operation with and without retries enabled @Test - public void testListLinksWRetries() throws Throwable { + public void testUpdateProfileWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListLinksWOptions(); + testUpdateProfileWOptions(); iamIdentityService.disableRetries(); - testListLinksWOptions(); + testUpdateProfileWOptions(); } - // Test the listLinks operation with a null options model (negative test) + // Test the updateProfile operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListLinksNoOptions() throws Throwable { + public void testUpdateProfileNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.listLinks(null).execute(); + iamIdentityService.updateProfile(null).execute(); } - // Test the getLink operation with a valid options model parameter + // Test the deleteProfile operation with a valid options model parameter @Test - public void testGetLinkWOptions() throws Throwable { + public void testDeleteProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"cr_type\": \"crType\", \"link\": {\"crn\": \"crn\", \"namespace\": \"namespace\", \"name\": \"name\"}}"; - String getLinkPath = "/v1/profiles/testString/links/testString"; + String mockResponseBody = ""; + String deleteProfilePath = "/v1/profiles/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the GetLinkOptions model - GetLinkOptions getLinkOptionsModel = new GetLinkOptions.Builder() + // Construct an instance of the DeleteProfileOptions model + DeleteProfileOptions deleteProfileOptionsModel = new DeleteProfileOptions.Builder() .profileId("testString") - .linkId("testString") .build(); - // Invoke getLink() with a valid options model and verify the result - Response response = iamIdentityService.getLink(getLinkOptionsModel).execute(); + // Invoke deleteProfile() with a valid options model and verify the result + Response response = iamIdentityService.deleteProfile(deleteProfileOptionsModel).execute(); assertNotNull(response); - ProfileLink responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getLinkPath); + assertEquals(parsedPath, deleteProfilePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getLink operation with and without retries enabled + // Test the deleteProfile operation with and without retries enabled @Test - public void testGetLinkWRetries() throws Throwable { + public void testDeleteProfileWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetLinkWOptions(); + testDeleteProfileWOptions(); iamIdentityService.disableRetries(); - testGetLinkWOptions(); + testDeleteProfileWOptions(); } - // Test the getLink operation with a null options model (negative test) + // Test the deleteProfile operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetLinkNoOptions() throws Throwable { + public void testDeleteProfileNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getLink(null).execute(); + iamIdentityService.deleteProfile(null).execute(); } - // Test the deleteLink operation with a valid options model parameter + // Test the createClaimRule operation with a valid options model parameter @Test - public void testDeleteLinkWOptions() throws Throwable { + public void testCreateClaimRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteLinkPath = "/v1/profiles/testString/links/testString"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}"; + String createClaimRulePath = "/v1/profiles/testString/rules"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the DeleteLinkOptions model - DeleteLinkOptions deleteLinkOptionsModel = new DeleteLinkOptions.Builder() + // Construct an instance of the ProfileClaimRuleConditions model + ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() + .claim("testString") + .operator("testString") + .value("testString") + .build(); + + // Construct an instance of the ResponseContext model + ResponseContext responseContextModel = new ResponseContext.Builder() + .transactionId("testString") + .operation("testString") + .userAgent("testString") + .url("testString") + .instanceId("testString") + .threadId("testString") + .host("testString") + .startTime("testString") + .endTime("testString") + .elapsedTime("testString") + .clusterName("testString") + .build(); + + // Construct an instance of the CreateClaimRuleOptions model + CreateClaimRuleOptions createClaimRuleOptionsModel = new CreateClaimRuleOptions.Builder() .profileId("testString") - .linkId("testString") + .type("testString") + .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) + .context(responseContextModel) + .name("testString") + .realmName("testString") + .crType("testString") + .expiration(Long.valueOf("26")) .build(); - // Invoke deleteLink() with a valid options model and verify the result - Response response = iamIdentityService.deleteLink(deleteLinkOptionsModel).execute(); + // Invoke createClaimRule() with a valid options model and verify the result + Response response = iamIdentityService.createClaimRule(createClaimRuleOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + ProfileClaimRule responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteLinkPath); + assertEquals(parsedPath, createClaimRulePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteLink operation with and without retries enabled + // Test the createClaimRule operation with and without retries enabled @Test - public void testDeleteLinkWRetries() throws Throwable { + public void testCreateClaimRuleWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteLinkWOptions(); + testCreateClaimRuleWOptions(); iamIdentityService.disableRetries(); - testDeleteLinkWOptions(); + testCreateClaimRuleWOptions(); } - // Test the deleteLink operation with a null options model (negative test) + // Test the createClaimRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteLinkNoOptions() throws Throwable { + public void testCreateClaimRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteLink(null).execute(); + iamIdentityService.createClaimRule(null).execute(); } - // Test the getProfileIdentities operation with a valid options model parameter + // Test the listClaimRules operation with a valid options model parameter @Test - public void testGetProfileIdentitiesWOptions() throws Throwable { + public void testListClaimRulesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"entity_tag\": \"entityTag\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}"; - String getProfileIdentitiesPath = "/v1/profiles/testString/identities"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"rules\": [{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}]}"; + String listClaimRulesPath = "/v1/profiles/testString/rules"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetProfileIdentitiesOptions model - GetProfileIdentitiesOptions getProfileIdentitiesOptionsModel = new GetProfileIdentitiesOptions.Builder() + // Construct an instance of the ListClaimRulesOptions model + ListClaimRulesOptions listClaimRulesOptionsModel = new ListClaimRulesOptions.Builder() .profileId("testString") .build(); - // Invoke getProfileIdentities() with a valid options model and verify the result - Response response = iamIdentityService.getProfileIdentities(getProfileIdentitiesOptionsModel).execute(); + // Invoke listClaimRules() with a valid options model and verify the result + Response response = iamIdentityService.listClaimRules(listClaimRulesOptionsModel).execute(); assertNotNull(response); - ProfileIdentitiesResponse responseObj = response.getResult(); + ProfileClaimRuleList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1949,274 +1773,297 @@ public void testGetProfileIdentitiesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProfileIdentitiesPath); + assertEquals(parsedPath, listClaimRulesPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProfileIdentities operation with and without retries enabled + // Test the listClaimRules operation with and without retries enabled @Test - public void testGetProfileIdentitiesWRetries() throws Throwable { + public void testListClaimRulesWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetProfileIdentitiesWOptions(); + testListClaimRulesWOptions(); iamIdentityService.disableRetries(); - testGetProfileIdentitiesWOptions(); + testListClaimRulesWOptions(); } - // Test the getProfileIdentities operation with a null options model (negative test) + // Test the listClaimRules operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProfileIdentitiesNoOptions() throws Throwable { + public void testListClaimRulesNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getProfileIdentities(null).execute(); + iamIdentityService.listClaimRules(null).execute(); } - // Test the setProfileIdentities operation with a valid options model parameter + // Test the getClaimRule operation with a valid options model parameter @Test - public void testSetProfileIdentitiesWOptions() throws Throwable { + public void testGetClaimRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"entity_tag\": \"entityTag\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}"; - String setProfileIdentitiesPath = "/v1/profiles/testString/identities"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}"; + String getClaimRulePath = "/v1/profiles/testString/rules/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ProfileIdentityRequest model - ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() - .identifier("testString") - .type("user") - .accounts(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Construct an instance of the SetProfileIdentitiesOptions model - SetProfileIdentitiesOptions setProfileIdentitiesOptionsModel = new SetProfileIdentitiesOptions.Builder() + // Construct an instance of the GetClaimRuleOptions model + GetClaimRuleOptions getClaimRuleOptionsModel = new GetClaimRuleOptions.Builder() .profileId("testString") - .ifMatch("testString") - .identities(java.util.Arrays.asList(profileIdentityRequestModel)) + .ruleId("testString") .build(); - // Invoke setProfileIdentities() with a valid options model and verify the result - Response response = iamIdentityService.setProfileIdentities(setProfileIdentitiesOptionsModel).execute(); + // Invoke getClaimRule() with a valid options model and verify the result + Response response = iamIdentityService.getClaimRule(getClaimRuleOptionsModel).execute(); assertNotNull(response); - ProfileIdentitiesResponse responseObj = response.getResult(); + ProfileClaimRule responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, setProfileIdentitiesPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, getClaimRulePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the setProfileIdentities operation with and without retries enabled + // Test the getClaimRule operation with and without retries enabled @Test - public void testSetProfileIdentitiesWRetries() throws Throwable { + public void testGetClaimRuleWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testSetProfileIdentitiesWOptions(); + testGetClaimRuleWOptions(); iamIdentityService.disableRetries(); - testSetProfileIdentitiesWOptions(); + testGetClaimRuleWOptions(); } - // Test the setProfileIdentities operation with a null options model (negative test) + // Test the getClaimRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testSetProfileIdentitiesNoOptions() throws Throwable { + public void testGetClaimRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.setProfileIdentities(null).execute(); + iamIdentityService.getClaimRule(null).execute(); } - // Test the setProfileIdentity operation with a valid options model parameter + // Test the updateClaimRule operation with a valid options model parameter @Test - public void testSetProfileIdentityWOptions() throws Throwable { + public void testUpdateClaimRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}"; - String setProfileIdentityPath = "/v1/profiles/testString/identities/user"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"type\": \"type\", \"realm_name\": \"realmName\", \"expiration\": 10, \"cr_type\": \"crType\", \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}"; + String updateClaimRulePath = "/v1/profiles/testString/rules/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the SetProfileIdentityOptions model - SetProfileIdentityOptions setProfileIdentityOptionsModel = new SetProfileIdentityOptions.Builder() + // Construct an instance of the ProfileClaimRuleConditions model + ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() + .claim("testString") + .operator("testString") + .value("testString") + .build(); + + // Construct an instance of the ResponseContext model + ResponseContext responseContextModel = new ResponseContext.Builder() + .transactionId("testString") + .operation("testString") + .userAgent("testString") + .url("testString") + .instanceId("testString") + .threadId("testString") + .host("testString") + .startTime("testString") + .endTime("testString") + .elapsedTime("testString") + .clusterName("testString") + .build(); + + // Construct an instance of the UpdateClaimRuleOptions model + UpdateClaimRuleOptions updateClaimRuleOptionsModel = new UpdateClaimRuleOptions.Builder() .profileId("testString") - .identityType("user") - .identifier("testString") - .type("user") - .accounts(java.util.Arrays.asList("testString")) - .description("testString") + .ruleId("testString") + .ifMatch("testString") + .type("testString") + .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) + .context(responseContextModel) + .name("testString") + .realmName("testString") + .crType("testString") + .expiration(Long.valueOf("26")) .build(); - // Invoke setProfileIdentity() with a valid options model and verify the result - Response response = iamIdentityService.setProfileIdentity(setProfileIdentityOptionsModel).execute(); + // Invoke updateClaimRule() with a valid options model and verify the result + Response response = iamIdentityService.updateClaimRule(updateClaimRuleOptionsModel).execute(); assertNotNull(response); - ProfileIdentityResponse responseObj = response.getResult(); + ProfileClaimRule responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, setProfileIdentityPath); + assertEquals(parsedPath, updateClaimRulePath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the setProfileIdentity operation with and without retries enabled + // Test the updateClaimRule operation with and without retries enabled @Test - public void testSetProfileIdentityWRetries() throws Throwable { + public void testUpdateClaimRuleWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testSetProfileIdentityWOptions(); + testUpdateClaimRuleWOptions(); iamIdentityService.disableRetries(); - testSetProfileIdentityWOptions(); + testUpdateClaimRuleWOptions(); } - // Test the setProfileIdentity operation with a null options model (negative test) + // Test the updateClaimRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testSetProfileIdentityNoOptions() throws Throwable { + public void testUpdateClaimRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.setProfileIdentity(null).execute(); + iamIdentityService.updateClaimRule(null).execute(); } - // Test the getProfileIdentity operation with a valid options model parameter + // Test the deleteClaimRule operation with a valid options model parameter @Test - public void testGetProfileIdentityWOptions() throws Throwable { + public void testDeleteClaimRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}"; - String getProfileIdentityPath = "/v1/profiles/testString/identities/user/testString"; + String mockResponseBody = ""; + String deleteClaimRulePath = "/v1/profiles/testString/rules/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the GetProfileIdentityOptions model - GetProfileIdentityOptions getProfileIdentityOptionsModel = new GetProfileIdentityOptions.Builder() + // Construct an instance of the DeleteClaimRuleOptions model + DeleteClaimRuleOptions deleteClaimRuleOptionsModel = new DeleteClaimRuleOptions.Builder() .profileId("testString") - .identityType("user") - .identifierId("testString") + .ruleId("testString") .build(); - // Invoke getProfileIdentity() with a valid options model and verify the result - Response response = iamIdentityService.getProfileIdentity(getProfileIdentityOptionsModel).execute(); + // Invoke deleteClaimRule() with a valid options model and verify the result + Response response = iamIdentityService.deleteClaimRule(deleteClaimRuleOptionsModel).execute(); assertNotNull(response); - ProfileIdentityResponse responseObj = response.getResult(); - assertNotNull(responseObj); - + Void responseObj = response.getResult(); + assertNull(responseObj); + // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProfileIdentityPath); + assertEquals(parsedPath, deleteClaimRulePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProfileIdentity operation with and without retries enabled + // Test the deleteClaimRule operation with and without retries enabled @Test - public void testGetProfileIdentityWRetries() throws Throwable { + public void testDeleteClaimRuleWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetProfileIdentityWOptions(); + testDeleteClaimRuleWOptions(); iamIdentityService.disableRetries(); - testGetProfileIdentityWOptions(); + testDeleteClaimRuleWOptions(); } - // Test the getProfileIdentity operation with a null options model (negative test) + // Test the deleteClaimRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProfileIdentityNoOptions() throws Throwable { + public void testDeleteClaimRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getProfileIdentity(null).execute(); + iamIdentityService.deleteClaimRule(null).execute(); } - // Test the deleteProfileIdentity operation with a valid options model parameter + // Test the createLink operation with a valid options model parameter @Test - public void testDeleteProfileIdentityWOptions() throws Throwable { + public void testCreateLinkWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteProfileIdentityPath = "/v1/profiles/testString/identities/user/testString"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"cr_type\": \"crType\", \"link\": {\"crn\": \"crn\", \"namespace\": \"namespace\", \"name\": \"name\"}}"; + String createLinkPath = "/v1/profiles/testString/links"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the DeleteProfileIdentityOptions model - DeleteProfileIdentityOptions deleteProfileIdentityOptionsModel = new DeleteProfileIdentityOptions.Builder() + // Construct an instance of the CreateProfileLinkRequestLink model + CreateProfileLinkRequestLink createProfileLinkRequestLinkModel = new CreateProfileLinkRequestLink.Builder() + .crn("testString") + .namespace("testString") + .name("testString") + .build(); + + // Construct an instance of the CreateLinkOptions model + CreateLinkOptions createLinkOptionsModel = new CreateLinkOptions.Builder() .profileId("testString") - .identityType("user") - .identifierId("testString") + .crType("testString") + .link(createProfileLinkRequestLinkModel) + .name("testString") .build(); - // Invoke deleteProfileIdentity() with a valid options model and verify the result - Response response = iamIdentityService.deleteProfileIdentity(deleteProfileIdentityOptionsModel).execute(); + // Invoke createLink() with a valid options model and verify the result + Response response = iamIdentityService.createLink(createLinkOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + ProfileLink responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteProfileIdentityPath); + assertEquals(parsedPath, createLinkPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteProfileIdentity operation with and without retries enabled + // Test the createLink operation with and without retries enabled @Test - public void testDeleteProfileIdentityWRetries() throws Throwable { + public void testCreateLinkWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteProfileIdentityWOptions(); + testCreateLinkWOptions(); iamIdentityService.disableRetries(); - testDeleteProfileIdentityWOptions(); + testCreateLinkWOptions(); } - // Test the deleteProfileIdentity operation with a null options model (negative test) + // Test the createLink operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteProfileIdentityNoOptions() throws Throwable { + public void testCreateLinkNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteProfileIdentity(null).execute(); + iamIdentityService.createLink(null).execute(); } - // Test the getAccountSettings operation with a valid options model parameter + // Test the listLinks operation with a valid options model parameter @Test - public void testGetAccountSettingsWOptions() throws Throwable { + public void testListLinksWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"account_id\": \"accountId\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"entity_tag\": \"entityTag\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}"; - String getAccountSettingsPath = "/v1/accounts/testString/settings/identity"; + String mockResponseBody = "{\"links\": [{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"cr_type\": \"crType\", \"link\": {\"crn\": \"crn\", \"namespace\": \"namespace\", \"name\": \"name\"}}]}"; + String listLinksPath = "/v1/profiles/testString/links"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetAccountSettingsOptions model - GetAccountSettingsOptions getAccountSettingsOptionsModel = new GetAccountSettingsOptions.Builder() - .accountId("testString") - .includeHistory(false) + // Construct an instance of the ListLinksOptions model + ListLinksOptions listLinksOptionsModel = new ListLinksOptions.Builder() + .profileId("testString") .build(); - // Invoke getAccountSettings() with a valid options model and verify the result - Response response = iamIdentityService.getAccountSettings(getAccountSettingsOptionsModel).execute(); + // Invoke listLinks() with a valid options model and verify the result + Response response = iamIdentityService.listLinks(listLinksOptionsModel).execute(); assertNotNull(response); - AccountSettingsResponse responseObj = response.getResult(); + ProfileLinkList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -2225,559 +2072,535 @@ public void testGetAccountSettingsWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getAccountSettingsPath); - // Verify query params + assertEquals(parsedPath, listLinksPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertNull(query); } - // Test the getAccountSettings operation with and without retries enabled + // Test the listLinks operation with and without retries enabled @Test - public void testGetAccountSettingsWRetries() throws Throwable { + public void testListLinksWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetAccountSettingsWOptions(); + testListLinksWOptions(); iamIdentityService.disableRetries(); - testGetAccountSettingsWOptions(); + testListLinksWOptions(); } - // Test the getAccountSettings operation with a null options model (negative test) + // Test the listLinks operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetAccountSettingsNoOptions() throws Throwable { + public void testListLinksNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getAccountSettings(null).execute(); + iamIdentityService.listLinks(null).execute(); } - // Test the updateAccountSettings operation with a valid options model parameter + // Test the getLink operation with a valid options model parameter @Test - public void testUpdateAccountSettingsWOptions() throws Throwable { + public void testGetLinkWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"account_id\": \"accountId\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"entity_tag\": \"entityTag\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}"; - String updateAccountSettingsPath = "/v1/accounts/testString/settings/identity"; + String mockResponseBody = "{\"id\": \"id\", \"entity_tag\": \"entityTag\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"modified_at\": \"2019-01-01T12:00:00.000Z\", \"name\": \"name\", \"cr_type\": \"crType\", \"link\": {\"crn\": \"crn\", \"namespace\": \"namespace\", \"name\": \"name\"}}"; + String getLinkPath = "/v1/profiles/testString/links/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the AccountSettingsUserMFA model - AccountSettingsUserMFA accountSettingsUserMfaModel = new AccountSettingsUserMFA.Builder() - .iamId("testString") - .mfa("NONE") - .build(); - - // Construct an instance of the UpdateAccountSettingsOptions model - UpdateAccountSettingsOptions updateAccountSettingsOptionsModel = new UpdateAccountSettingsOptions.Builder() - .ifMatch("testString") - .accountId("testString") - .restrictCreateServiceId("RESTRICTED") - .restrictCreatePlatformApikey("RESTRICTED") - .allowedIpAddresses("testString") - .mfa("NONE") - .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) - .sessionExpirationInSeconds("86400") - .sessionInvalidationInSeconds("7200") - .maxSessionsPerIdentity("testString") - .systemAccessTokenExpirationInSeconds("3600") - .systemRefreshTokenExpirationInSeconds("259200") + // Construct an instance of the GetLinkOptions model + GetLinkOptions getLinkOptionsModel = new GetLinkOptions.Builder() + .profileId("testString") + .linkId("testString") .build(); - // Invoke updateAccountSettings() with a valid options model and verify the result - Response response = iamIdentityService.updateAccountSettings(updateAccountSettingsOptionsModel).execute(); + // Invoke getLink() with a valid options model and verify the result + Response response = iamIdentityService.getLink(getLinkOptionsModel).execute(); assertNotNull(response); - AccountSettingsResponse responseObj = response.getResult(); + ProfileLink responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateAccountSettingsPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, getLinkPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updateAccountSettings operation with and without retries enabled + // Test the getLink operation with and without retries enabled @Test - public void testUpdateAccountSettingsWRetries() throws Throwable { + public void testGetLinkWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateAccountSettingsWOptions(); + testGetLinkWOptions(); iamIdentityService.disableRetries(); - testUpdateAccountSettingsWOptions(); + testGetLinkWOptions(); } - // Test the updateAccountSettings operation with a null options model (negative test) + // Test the getLink operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateAccountSettingsNoOptions() throws Throwable { + public void testGetLinkNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateAccountSettings(null).execute(); + iamIdentityService.getLink(null).execute(); } - // Test the getMfaStatus operation with a valid options model parameter + // Test the deleteLink operation with a valid options model parameter @Test - public void testGetMfaStatusWOptions() throws Throwable { + public void testDeleteLinkWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"iam_id\": \"iamId\", \"effective_mfa_type\": \"effectiveMfaType\", \"id_based_mfa\": {\"trait_account_default\": \"NONE\", \"trait_user_specific\": \"NONE\", \"trait_effective\": \"NONE\", \"complies\": true, \"comply_state\": \"NO\"}, \"account_based_mfa\": {\"security_questions\": {\"required\": true, \"enrolled\": true}, \"totp\": {\"required\": true, \"enrolled\": true}, \"verisign\": {\"required\": true, \"enrolled\": true}, \"complies\": true}}"; - String getMfaStatusPath = "/v1/mfa/accounts/testString/status"; + String mockResponseBody = ""; + String deleteLinkPath = "/v1/profiles/testString/links/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the GetMfaStatusOptions model - GetMfaStatusOptions getMfaStatusOptionsModel = new GetMfaStatusOptions.Builder() - .accountId("testString") - .iamId("testString") + // Construct an instance of the DeleteLinkOptions model + DeleteLinkOptions deleteLinkOptionsModel = new DeleteLinkOptions.Builder() + .profileId("testString") + .linkId("testString") .build(); - // Invoke getMfaStatus() with a valid options model and verify the result - Response response = iamIdentityService.getMfaStatus(getMfaStatusOptionsModel).execute(); + // Invoke deleteLink() with a valid options model and verify the result + Response response = iamIdentityService.deleteLink(deleteLinkOptionsModel).execute(); assertNotNull(response); - UserMfaEnrollments responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMfaStatusPath); - // Verify query params + assertEquals(parsedPath, deleteLinkPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("iam_id"), "testString"); + assertNull(query); } - // Test the getMfaStatus operation with and without retries enabled + // Test the deleteLink operation with and without retries enabled @Test - public void testGetMfaStatusWRetries() throws Throwable { + public void testDeleteLinkWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetMfaStatusWOptions(); + testDeleteLinkWOptions(); iamIdentityService.disableRetries(); - testGetMfaStatusWOptions(); + testDeleteLinkWOptions(); } - // Test the getMfaStatus operation with a null options model (negative test) + // Test the deleteLink operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetMfaStatusNoOptions() throws Throwable { + public void testDeleteLinkNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getMfaStatus(null).execute(); + iamIdentityService.deleteLink(null).execute(); } - // Test the createMfaReport operation with a valid options model parameter + // Test the getProfileIdentities operation with a valid options model parameter @Test - public void testCreateMfaReportWOptions() throws Throwable { + public void testGetProfileIdentitiesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"reference\": \"reference\"}"; - String createMfaReportPath = "/v1/mfa/accounts/testString/report"; + String mockResponseBody = "{\"entity_tag\": \"entityTag\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}"; + String getProfileIdentitiesPath = "/v1/profiles/testString/identities"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(202) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CreateMfaReportOptions model - CreateMfaReportOptions createMfaReportOptionsModel = new CreateMfaReportOptions.Builder() - .accountId("testString") - .type("testString") + // Construct an instance of the GetProfileIdentitiesOptions model + GetProfileIdentitiesOptions getProfileIdentitiesOptionsModel = new GetProfileIdentitiesOptions.Builder() + .profileId("testString") .build(); - // Invoke createMfaReport() with a valid options model and verify the result - Response response = iamIdentityService.createMfaReport(createMfaReportOptionsModel).execute(); + // Invoke getProfileIdentities() with a valid options model and verify the result + Response response = iamIdentityService.getProfileIdentities(getProfileIdentitiesOptionsModel).execute(); assertNotNull(response); - ReportReference responseObj = response.getResult(); + ProfileIdentitiesResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createMfaReportPath); - // Verify query params + assertEquals(parsedPath, getProfileIdentitiesPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("type"), "testString"); + assertNull(query); } - // Test the createMfaReport operation with and without retries enabled + // Test the getProfileIdentities operation with and without retries enabled @Test - public void testCreateMfaReportWRetries() throws Throwable { + public void testGetProfileIdentitiesWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateMfaReportWOptions(); + testGetProfileIdentitiesWOptions(); iamIdentityService.disableRetries(); - testCreateMfaReportWOptions(); + testGetProfileIdentitiesWOptions(); } - // Test the createMfaReport operation with a null options model (negative test) + // Test the getProfileIdentities operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateMfaReportNoOptions() throws Throwable { + public void testGetProfileIdentitiesNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createMfaReport(null).execute(); + iamIdentityService.getProfileIdentities(null).execute(); } - // Test the getMfaReport operation with a valid options model parameter + // Test the setProfileIdentities operation with a valid options model parameter @Test - public void testGetMfaReportWOptions() throws Throwable { + public void testSetProfileIdentitiesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"created_by\": \"createdBy\", \"reference\": \"reference\", \"report_time\": \"reportTime\", \"account_id\": \"accountId\", \"ims_account_id\": \"imsAccountId\", \"users\": [{\"iam_id\": \"iamId\", \"name\": \"name\", \"username\": \"username\", \"email\": \"email\", \"enrollments\": {\"effective_mfa_type\": \"effectiveMfaType\", \"id_based_mfa\": {\"trait_account_default\": \"NONE\", \"trait_user_specific\": \"NONE\", \"trait_effective\": \"NONE\", \"complies\": true, \"comply_state\": \"NO\"}, \"account_based_mfa\": {\"security_questions\": {\"required\": true, \"enrolled\": true}, \"totp\": {\"required\": true, \"enrolled\": true}, \"verisign\": {\"required\": true, \"enrolled\": true}, \"complies\": true}}}]}"; - String getMfaReportPath = "/v1/mfa/accounts/testString/report/testString"; + String mockResponseBody = "{\"entity_tag\": \"entityTag\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}"; + String setProfileIdentitiesPath = "/v1/profiles/testString/identities"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetMfaReportOptions model - GetMfaReportOptions getMfaReportOptionsModel = new GetMfaReportOptions.Builder() - .accountId("testString") - .reference("testString") + // Construct an instance of the ProfileIdentityRequest model + ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() + .identifier("testString") + .type("user") + .accounts(java.util.Arrays.asList("testString")) + .description("testString") .build(); - // Invoke getMfaReport() with a valid options model and verify the result - Response response = iamIdentityService.getMfaReport(getMfaReportOptionsModel).execute(); + // Construct an instance of the SetProfileIdentitiesOptions model + SetProfileIdentitiesOptions setProfileIdentitiesOptionsModel = new SetProfileIdentitiesOptions.Builder() + .profileId("testString") + .ifMatch("testString") + .identities(java.util.Arrays.asList(profileIdentityRequestModel)) + .build(); + + // Invoke setProfileIdentities() with a valid options model and verify the result + Response response = iamIdentityService.setProfileIdentities(setProfileIdentitiesOptionsModel).execute(); assertNotNull(response); - ReportMfaEnrollmentStatus responseObj = response.getResult(); + ProfileIdentitiesResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMfaReportPath); + assertEquals(parsedPath, setProfileIdentitiesPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getMfaReport operation with and without retries enabled + // Test the setProfileIdentities operation with and without retries enabled @Test - public void testGetMfaReportWRetries() throws Throwable { + public void testSetProfileIdentitiesWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetMfaReportWOptions(); + testSetProfileIdentitiesWOptions(); iamIdentityService.disableRetries(); - testGetMfaReportWOptions(); + testSetProfileIdentitiesWOptions(); } - // Test the getMfaReport operation with a null options model (negative test) + // Test the setProfileIdentities operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetMfaReportNoOptions() throws Throwable { + public void testSetProfileIdentitiesNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getMfaReport(null).execute(); + iamIdentityService.setProfileIdentities(null).execute(); } - // Test the listAccountSettingsAssignments operation with a valid options model parameter + // Test the setProfileIdentity operation with a valid options model parameter @Test - public void testListAccountSettingsAssignmentsWOptions() throws Throwable { + public void testSetProfileIdentityWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"assignments\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}]}"; - String listAccountSettingsAssignmentsPath = "/v1/account_settings_assignments/"; + String mockResponseBody = "{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}"; + String setProfileIdentityPath = "/v1/profiles/testString/identities/user"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListAccountSettingsAssignmentsOptions model - ListAccountSettingsAssignmentsOptions listAccountSettingsAssignmentsOptionsModel = new ListAccountSettingsAssignmentsOptions.Builder() - .accountId("testString") - .templateId("testString") - .templateVersion("testString") - .target("testString") - .targetType("Account") - .limit(Long.valueOf("20")) - .pagetoken("testString") - .sort("created_at") - .order("asc") - .includeHistory(false) + // Construct an instance of the SetProfileIdentityOptions model + SetProfileIdentityOptions setProfileIdentityOptionsModel = new SetProfileIdentityOptions.Builder() + .profileId("testString") + .identityType("user") + .identifier("testString") + .type("user") + .accounts(java.util.Arrays.asList("testString")) + .description("testString") .build(); - // Invoke listAccountSettingsAssignments() with a valid options model and verify the result - Response response = iamIdentityService.listAccountSettingsAssignments(listAccountSettingsAssignmentsOptionsModel).execute(); + // Invoke setProfileIdentity() with a valid options model and verify the result + Response response = iamIdentityService.setProfileIdentity(setProfileIdentityOptionsModel).execute(); assertNotNull(response); - TemplateAssignmentListResponse responseObj = response.getResult(); + ProfileIdentityResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listAccountSettingsAssignmentsPath); - // Verify query params + assertEquals(parsedPath, setProfileIdentityPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(query.get("target"), "testString"); - assertEquals(query.get("target_type"), "Account"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("20")); - assertEquals(query.get("pagetoken"), "testString"); - assertEquals(query.get("sort"), "created_at"); - assertEquals(query.get("order"), "asc"); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertNull(query); } - // Test the listAccountSettingsAssignments operation with and without retries enabled + // Test the setProfileIdentity operation with and without retries enabled @Test - public void testListAccountSettingsAssignmentsWRetries() throws Throwable { + public void testSetProfileIdentityWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListAccountSettingsAssignmentsWOptions(); + testSetProfileIdentityWOptions(); iamIdentityService.disableRetries(); - testListAccountSettingsAssignmentsWOptions(); + testSetProfileIdentityWOptions(); } - // Test the createAccountSettingsAssignment operation with a valid options model parameter + // Test the setProfileIdentity operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSetProfileIdentityNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.setProfileIdentity(null).execute(); + } + + // Test the getProfileIdentity operation with a valid options model parameter @Test - public void testCreateAccountSettingsAssignmentWOptions() throws Throwable { + public void testGetProfileIdentityWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}"; - String createAccountSettingsAssignmentPath = "/v1/account_settings_assignments/"; + String mockResponseBody = "{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}"; + String getProfileIdentityPath = "/v1/profiles/testString/identities/user/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(202) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CreateAccountSettingsAssignmentOptions model - CreateAccountSettingsAssignmentOptions createAccountSettingsAssignmentOptionsModel = new CreateAccountSettingsAssignmentOptions.Builder() - .templateId("testString") - .templateVersion(Long.valueOf("1")) - .targetType("Account") - .target("testString") + // Construct an instance of the GetProfileIdentityOptions model + GetProfileIdentityOptions getProfileIdentityOptionsModel = new GetProfileIdentityOptions.Builder() + .profileId("testString") + .identityType("user") + .identifierId("testString") .build(); - // Invoke createAccountSettingsAssignment() with a valid options model and verify the result - Response response = iamIdentityService.createAccountSettingsAssignment(createAccountSettingsAssignmentOptionsModel).execute(); + // Invoke getProfileIdentity() with a valid options model and verify the result + Response response = iamIdentityService.getProfileIdentity(getProfileIdentityOptionsModel).execute(); assertNotNull(response); - TemplateAssignmentResponse responseObj = response.getResult(); + ProfileIdentityResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createAccountSettingsAssignmentPath); + assertEquals(parsedPath, getProfileIdentityPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createAccountSettingsAssignment operation with and without retries enabled + // Test the getProfileIdentity operation with and without retries enabled @Test - public void testCreateAccountSettingsAssignmentWRetries() throws Throwable { + public void testGetProfileIdentityWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateAccountSettingsAssignmentWOptions(); + testGetProfileIdentityWOptions(); iamIdentityService.disableRetries(); - testCreateAccountSettingsAssignmentWOptions(); + testGetProfileIdentityWOptions(); } - // Test the createAccountSettingsAssignment operation with a null options model (negative test) + // Test the getProfileIdentity operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateAccountSettingsAssignmentNoOptions() throws Throwable { + public void testGetProfileIdentityNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createAccountSettingsAssignment(null).execute(); + iamIdentityService.getProfileIdentity(null).execute(); } - // Test the getAccountSettingsAssignment operation with a valid options model parameter + // Test the deleteProfileIdentity operation with a valid options model parameter @Test - public void testGetAccountSettingsAssignmentWOptions() throws Throwable { + public void testDeleteProfileIdentityWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}"; - String getAccountSettingsAssignmentPath = "/v1/account_settings_assignments/testString"; + String mockResponseBody = ""; + String deleteProfileIdentityPath = "/v1/profiles/testString/identities/user/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the GetAccountSettingsAssignmentOptions model - GetAccountSettingsAssignmentOptions getAccountSettingsAssignmentOptionsModel = new GetAccountSettingsAssignmentOptions.Builder() - .assignmentId("testString") - .includeHistory(false) + // Construct an instance of the DeleteProfileIdentityOptions model + DeleteProfileIdentityOptions deleteProfileIdentityOptionsModel = new DeleteProfileIdentityOptions.Builder() + .profileId("testString") + .identityType("user") + .identifierId("testString") .build(); - // Invoke getAccountSettingsAssignment() with a valid options model and verify the result - Response response = iamIdentityService.getAccountSettingsAssignment(getAccountSettingsAssignmentOptionsModel).execute(); + // Invoke deleteProfileIdentity() with a valid options model and verify the result + Response response = iamIdentityService.deleteProfileIdentity(deleteProfileIdentityOptionsModel).execute(); assertNotNull(response); - TemplateAssignmentResponse responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getAccountSettingsAssignmentPath); - // Verify query params + assertEquals(parsedPath, deleteProfileIdentityPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertNull(query); } - // Test the getAccountSettingsAssignment operation with and without retries enabled + // Test the deleteProfileIdentity operation with and without retries enabled @Test - public void testGetAccountSettingsAssignmentWRetries() throws Throwable { + public void testDeleteProfileIdentityWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetAccountSettingsAssignmentWOptions(); + testDeleteProfileIdentityWOptions(); iamIdentityService.disableRetries(); - testGetAccountSettingsAssignmentWOptions(); + testDeleteProfileIdentityWOptions(); } - // Test the getAccountSettingsAssignment operation with a null options model (negative test) + // Test the deleteProfileIdentity operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetAccountSettingsAssignmentNoOptions() throws Throwable { + public void testDeleteProfileIdentityNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getAccountSettingsAssignment(null).execute(); + iamIdentityService.deleteProfileIdentity(null).execute(); } - // Test the deleteAccountSettingsAssignment operation with a valid options model parameter + // Test the createReport operation with a valid options model parameter @Test - public void testDeleteAccountSettingsAssignmentWOptions() throws Throwable { + public void testCreateReportWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"status_code\": \"statusCode\", \"errors\": [{\"code\": \"code\", \"message_code\": \"messageCode\", \"message\": \"message\", \"details\": \"details\"}], \"trace\": \"trace\"}"; - String deleteAccountSettingsAssignmentPath = "/v1/account_settings_assignments/testString"; + String mockResponseBody = "{\"reference\": \"reference\"}"; + String createReportPath = "/v1/activity/accounts/testString/report"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(202) .setBody(mockResponseBody)); - // Construct an instance of the DeleteAccountSettingsAssignmentOptions model - DeleteAccountSettingsAssignmentOptions deleteAccountSettingsAssignmentOptionsModel = new DeleteAccountSettingsAssignmentOptions.Builder() - .assignmentId("testString") + // Construct an instance of the CreateReportOptions model + CreateReportOptions createReportOptionsModel = new CreateReportOptions.Builder() + .accountId("testString") + .type("inactive") + .duration("720") .build(); - // Invoke deleteAccountSettingsAssignment() with a valid options model and verify the result - Response response = iamIdentityService.deleteAccountSettingsAssignment(deleteAccountSettingsAssignmentOptionsModel).execute(); + // Invoke createReport() with a valid options model and verify the result + Response response = iamIdentityService.createReport(createReportOptionsModel).execute(); assertNotNull(response); - ExceptionResponse responseObj = response.getResult(); + ReportReference responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteAccountSettingsAssignmentPath); - // Verify that there is no query string + assertEquals(parsedPath, createReportPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("type"), "inactive"); + assertEquals(query.get("duration"), "720"); } - // Test the deleteAccountSettingsAssignment operation with and without retries enabled + // Test the createReport operation with and without retries enabled @Test - public void testDeleteAccountSettingsAssignmentWRetries() throws Throwable { + public void testCreateReportWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteAccountSettingsAssignmentWOptions(); + testCreateReportWOptions(); iamIdentityService.disableRetries(); - testDeleteAccountSettingsAssignmentWOptions(); + testCreateReportWOptions(); } - // Test the deleteAccountSettingsAssignment operation with a null options model (negative test) + // Test the createReport operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteAccountSettingsAssignmentNoOptions() throws Throwable { + public void testCreateReportNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteAccountSettingsAssignment(null).execute(); + iamIdentityService.createReport(null).execute(); } - // Test the updateAccountSettingsAssignment operation with a valid options model parameter + // Test the getReport operation with a valid options model parameter @Test - public void testUpdateAccountSettingsAssignmentWOptions() throws Throwable { + public void testGetReportWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}"; - String updateAccountSettingsAssignmentPath = "/v1/account_settings_assignments/testString"; + String mockResponseBody = "{\"created_by\": \"createdBy\", \"reference\": \"reference\", \"report_duration\": \"reportDuration\", \"report_start_time\": \"reportStartTime\", \"report_end_time\": \"reportEndTime\", \"users\": [{\"iam_id\": \"iamId\", \"name\": \"name\", \"username\": \"username\", \"email\": \"email\", \"last_authn\": \"lastAuthn\"}], \"apikeys\": [{\"id\": \"id\", \"name\": \"name\", \"type\": \"type\", \"serviceid\": {\"id\": \"id\", \"name\": \"name\"}, \"user\": {\"iam_id\": \"iamId\", \"name\": \"name\", \"username\": \"username\", \"email\": \"email\"}, \"last_authn\": \"lastAuthn\"}], \"serviceids\": [{\"id\": \"id\", \"name\": \"name\", \"last_authn\": \"lastAuthn\"}], \"profiles\": [{\"id\": \"id\", \"name\": \"name\", \"last_authn\": \"lastAuthn\"}]}"; + String getReportPath = "/v1/activity/accounts/testString/report/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the UpdateAccountSettingsAssignmentOptions model - UpdateAccountSettingsAssignmentOptions updateAccountSettingsAssignmentOptionsModel = new UpdateAccountSettingsAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion(Long.valueOf("1")) + // Construct an instance of the GetReportOptions model + GetReportOptions getReportOptionsModel = new GetReportOptions.Builder() + .accountId("testString") + .reference("testString") .build(); - // Invoke updateAccountSettingsAssignment() with a valid options model and verify the result - Response response = iamIdentityService.updateAccountSettingsAssignment(updateAccountSettingsAssignmentOptionsModel).execute(); + // Invoke getReport() with a valid options model and verify the result + Response response = iamIdentityService.getReport(getReportOptionsModel).execute(); assertNotNull(response); - TemplateAssignmentResponse responseObj = response.getResult(); + Report responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PATCH"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateAccountSettingsAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, getReportPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updateAccountSettingsAssignment operation with and without retries enabled + // Test the getReport operation with and without retries enabled @Test - public void testUpdateAccountSettingsAssignmentWRetries() throws Throwable { + public void testGetReportWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateAccountSettingsAssignmentWOptions(); + testGetReportWOptions(); iamIdentityService.disableRetries(); - testUpdateAccountSettingsAssignmentWOptions(); + testGetReportWOptions(); } - // Test the updateAccountSettingsAssignment operation with a null options model (negative test) + // Test the getReport operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateAccountSettingsAssignmentNoOptions() throws Throwable { + public void testGetReportNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateAccountSettingsAssignment(null).execute(); + iamIdentityService.getReport(null).execute(); } - // Test the listAccountSettingsTemplates operation with a valid options model parameter + // Test the getAccountSettings operation with a valid options model parameter @Test - public void testListAccountSettingsTemplatesWOptions() throws Throwable { + public void testGetAccountSettingsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"account_settings_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listAccountSettingsTemplatesPath = "/v1/account_settings_templates"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"account_id\": \"accountId\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"entity_tag\": \"entityTag\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}"; + String getAccountSettingsPath = "/v1/accounts/testString/settings/identity"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListAccountSettingsTemplatesOptions model - ListAccountSettingsTemplatesOptions listAccountSettingsTemplatesOptionsModel = new ListAccountSettingsTemplatesOptions.Builder() + // Construct an instance of the GetAccountSettingsOptions model + GetAccountSettingsOptions getAccountSettingsOptionsModel = new GetAccountSettingsOptions.Builder() .accountId("testString") - .limit("20") - .pagetoken("testString") - .sort("created_at") - .order("asc") - .includeHistory("false") + .includeHistory(false) .build(); - // Invoke listAccountSettingsTemplates() with a valid options model and verify the result - Response response = iamIdentityService.listAccountSettingsTemplates(listAccountSettingsTemplatesOptionsModel).execute(); + // Invoke getAccountSettings() with a valid options model and verify the result + Response response = iamIdentityService.getAccountSettings(getAccountSettingsOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateList responseObj = response.getResult(); + AccountSettingsResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -2786,37 +2609,39 @@ public void testListAccountSettingsTemplatesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listAccountSettingsTemplatesPath); + assertEquals(parsedPath, getAccountSettingsPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("limit"), "20"); - assertEquals(query.get("pagetoken"), "testString"); - assertEquals(query.get("sort"), "created_at"); - assertEquals(query.get("order"), "asc"); - assertEquals(query.get("include_history"), "false"); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); } - // Test the listAccountSettingsTemplates operation with and without retries enabled + // Test the getAccountSettings operation with and without retries enabled @Test - public void testListAccountSettingsTemplatesWRetries() throws Throwable { + public void testGetAccountSettingsWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListAccountSettingsTemplatesWOptions(); + testGetAccountSettingsWOptions(); iamIdentityService.disableRetries(); - testListAccountSettingsTemplatesWOptions(); + testGetAccountSettingsWOptions(); } - // Test the createAccountSettingsTemplate operation with a valid options model parameter + // Test the getAccountSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccountSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.getAccountSettings(null).execute(); + } + + // Test the updateAccountSettings operation with a valid options model parameter @Test - public void testCreateAccountSettingsTemplateWOptions() throws Throwable { + public void testUpdateAccountSettingsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String createAccountSettingsTemplatePath = "/v1/account_settings_templates"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"account_id\": \"accountId\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"entity_tag\": \"entityTag\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}"; + String updateAccountSettingsPath = "/v1/accounts/testString/settings/identity"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(200) .setBody(mockResponseBody)); // Construct an instance of the AccountSettingsUserMFA model @@ -2825,10 +2650,12 @@ public void testCreateAccountSettingsTemplateWOptions() throws Throwable { .mfa("NONE") .build(); - // Construct an instance of the AccountSettingsComponent model - AccountSettingsComponent accountSettingsComponentModel = new AccountSettingsComponent.Builder() - .restrictCreateServiceId("NOT_SET") - .restrictCreatePlatformApikey("NOT_SET") + // Construct an instance of the UpdateAccountSettingsOptions model + UpdateAccountSettingsOptions updateAccountSettingsOptionsModel = new UpdateAccountSettingsOptions.Builder() + .ifMatch("testString") + .accountId("testString") + .restrictCreateServiceId("RESTRICTED") + .restrictCreatePlatformApikey("RESTRICTED") .allowedIpAddresses("testString") .mfa("NONE") .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) @@ -2839,63 +2666,65 @@ public void testCreateAccountSettingsTemplateWOptions() throws Throwable { .systemRefreshTokenExpirationInSeconds("259200") .build(); - // Construct an instance of the CreateAccountSettingsTemplateOptions model - CreateAccountSettingsTemplateOptions createAccountSettingsTemplateOptionsModel = new CreateAccountSettingsTemplateOptions.Builder() - .accountId("testString") - .name("testString") - .description("testString") - .accountSettings(accountSettingsComponentModel) - .build(); - - // Invoke createAccountSettingsTemplate() with a valid options model and verify the result - Response response = iamIdentityService.createAccountSettingsTemplate(createAccountSettingsTemplateOptionsModel).execute(); + // Invoke updateAccountSettings() with a valid options model and verify the result + Response response = iamIdentityService.updateAccountSettings(updateAccountSettingsOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateResponse responseObj = response.getResult(); + AccountSettingsResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createAccountSettingsTemplatePath); + assertEquals(parsedPath, updateAccountSettingsPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createAccountSettingsTemplate operation with and without retries enabled + // Test the updateAccountSettings operation with and without retries enabled @Test - public void testCreateAccountSettingsTemplateWRetries() throws Throwable { + public void testUpdateAccountSettingsWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateAccountSettingsTemplateWOptions(); + testUpdateAccountSettingsWOptions(); iamIdentityService.disableRetries(); - testCreateAccountSettingsTemplateWOptions(); + testUpdateAccountSettingsWOptions(); } - // Test the getLatestAccountSettingsTemplateVersion operation with a valid options model parameter + // Test the updateAccountSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccountSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.updateAccountSettings(null).execute(); + } + + // Test the getEffectiveAccountSettings operation with a valid options model parameter @Test - public void testGetLatestAccountSettingsTemplateVersionWOptions() throws Throwable { + public void testGetEffectiveAccountSettingsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getLatestAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"account_id\": \"accountId\", \"effective\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\", \"name\": \"name\", \"userName\": \"userName\", \"email\": \"email\", \"description\": \"description\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"account\": {\"account_id\": \"accountId\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\", \"name\": \"name\", \"userName\": \"userName\", \"email\": \"email\", \"description\": \"description\"}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"assigned_templates\": [{\"template_id\": \"templateId\", \"template_version\": 15, \"template_name\": \"templateName\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\", \"name\": \"name\", \"userName\": \"userName\", \"email\": \"email\", \"description\": \"description\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}]}"; + String getEffectiveAccountSettingsPath = "/v1/accounts/testString/effective_settings/identity"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetLatestAccountSettingsTemplateVersionOptions model - GetLatestAccountSettingsTemplateVersionOptions getLatestAccountSettingsTemplateVersionOptionsModel = new GetLatestAccountSettingsTemplateVersionOptions.Builder() - .templateId("testString") + // Construct an instance of the GetEffectiveAccountSettingsOptions model + GetEffectiveAccountSettingsOptions getEffectiveAccountSettingsOptionsModel = new GetEffectiveAccountSettingsOptions.Builder() + .accountId("testString") .includeHistory(false) + .resolveUserMfa(false) .build(); - // Invoke getLatestAccountSettingsTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.getLatestAccountSettingsTemplateVersion(getLatestAccountSettingsTemplateVersionOptionsModel).execute(); + // Invoke getEffectiveAccountSettings() with a valid options model and verify the result + Response response = iamIdentityService.getEffectiveAccountSettings(getEffectiveAccountSettingsOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateResponse responseObj = response.getResult(); + EffectiveAccountSettingsResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -2904,580 +2733,593 @@ public void testGetLatestAccountSettingsTemplateVersionWOptions() throws Throwab assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getLatestAccountSettingsTemplateVersionPath); + assertEquals(parsedPath, getEffectiveAccountSettingsPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertEquals(Boolean.valueOf(query.get("resolve_user_mfa")), Boolean.valueOf(false)); } - // Test the getLatestAccountSettingsTemplateVersion operation with and without retries enabled + // Test the getEffectiveAccountSettings operation with and without retries enabled @Test - public void testGetLatestAccountSettingsTemplateVersionWRetries() throws Throwable { + public void testGetEffectiveAccountSettingsWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetLatestAccountSettingsTemplateVersionWOptions(); + testGetEffectiveAccountSettingsWOptions(); iamIdentityService.disableRetries(); - testGetLatestAccountSettingsTemplateVersionWOptions(); + testGetEffectiveAccountSettingsWOptions(); } - // Test the getLatestAccountSettingsTemplateVersion operation with a null options model (negative test) + // Test the getEffectiveAccountSettings operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetLatestAccountSettingsTemplateVersionNoOptions() throws Throwable { + public void testGetEffectiveAccountSettingsNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getLatestAccountSettingsTemplateVersion(null).execute(); + iamIdentityService.getEffectiveAccountSettings(null).execute(); } - // Test the deleteAllVersionsOfAccountSettingsTemplate operation with a valid options model parameter + // Test the getMfaStatus operation with a valid options model parameter @Test - public void testDeleteAllVersionsOfAccountSettingsTemplateWOptions() throws Throwable { + public void testGetMfaStatusWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteAllVersionsOfAccountSettingsTemplatePath = "/v1/account_settings_templates/testString"; + String mockResponseBody = "{\"iam_id\": \"iamId\", \"effective_mfa_type\": \"effectiveMfaType\", \"id_based_mfa\": {\"trait_account_default\": \"NONE\", \"trait_user_specific\": \"NONE\", \"trait_effective\": \"NONE\", \"complies\": true, \"comply_state\": \"NO\"}, \"account_based_mfa\": {\"security_questions\": {\"required\": true, \"enrolled\": true}, \"totp\": {\"required\": true, \"enrolled\": true}, \"verisign\": {\"required\": true, \"enrolled\": true}, \"complies\": true}}"; + String getMfaStatusPath = "/v1/mfa/accounts/testString/status"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteAllVersionsOfAccountSettingsTemplateOptions model - DeleteAllVersionsOfAccountSettingsTemplateOptions deleteAllVersionsOfAccountSettingsTemplateOptionsModel = new DeleteAllVersionsOfAccountSettingsTemplateOptions.Builder() - .templateId("testString") + // Construct an instance of the GetMfaStatusOptions model + GetMfaStatusOptions getMfaStatusOptionsModel = new GetMfaStatusOptions.Builder() + .accountId("testString") + .iamId("testString") .build(); - // Invoke deleteAllVersionsOfAccountSettingsTemplate() with a valid options model and verify the result - Response response = iamIdentityService.deleteAllVersionsOfAccountSettingsTemplate(deleteAllVersionsOfAccountSettingsTemplateOptionsModel).execute(); + // Invoke getMfaStatus() with a valid options model and verify the result + Response response = iamIdentityService.getMfaStatus(getMfaStatusOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + UserMfaEnrollments responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteAllVersionsOfAccountSettingsTemplatePath); - // Verify that there is no query string + assertEquals(parsedPath, getMfaStatusPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("iam_id"), "testString"); } - // Test the deleteAllVersionsOfAccountSettingsTemplate operation with and without retries enabled + // Test the getMfaStatus operation with and without retries enabled @Test - public void testDeleteAllVersionsOfAccountSettingsTemplateWRetries() throws Throwable { + public void testGetMfaStatusWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteAllVersionsOfAccountSettingsTemplateWOptions(); + testGetMfaStatusWOptions(); iamIdentityService.disableRetries(); - testDeleteAllVersionsOfAccountSettingsTemplateWOptions(); + testGetMfaStatusWOptions(); } - // Test the deleteAllVersionsOfAccountSettingsTemplate operation with a null options model (negative test) + // Test the getMfaStatus operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteAllVersionsOfAccountSettingsTemplateNoOptions() throws Throwable { + public void testGetMfaStatusNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteAllVersionsOfAccountSettingsTemplate(null).execute(); + iamIdentityService.getMfaStatus(null).execute(); } - // Test the listVersionsOfAccountSettingsTemplate operation with a valid options model parameter + // Test the createMfaReport operation with a valid options model parameter @Test - public void testListVersionsOfAccountSettingsTemplateWOptions() throws Throwable { + public void testCreateMfaReportWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"account_settings_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listVersionsOfAccountSettingsTemplatePath = "/v1/account_settings_templates/testString/versions"; + String mockResponseBody = "{\"reference\": \"reference\"}"; + String createMfaReportPath = "/v1/mfa/accounts/testString/report"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(202) .setBody(mockResponseBody)); - // Construct an instance of the ListVersionsOfAccountSettingsTemplateOptions model - ListVersionsOfAccountSettingsTemplateOptions listVersionsOfAccountSettingsTemplateOptionsModel = new ListVersionsOfAccountSettingsTemplateOptions.Builder() - .templateId("testString") - .limit("20") - .pagetoken("testString") - .sort("created_at") - .order("asc") - .includeHistory("false") + // Construct an instance of the CreateMfaReportOptions model + CreateMfaReportOptions createMfaReportOptionsModel = new CreateMfaReportOptions.Builder() + .accountId("testString") + .type("testString") .build(); - // Invoke listVersionsOfAccountSettingsTemplate() with a valid options model and verify the result - Response response = iamIdentityService.listVersionsOfAccountSettingsTemplate(listVersionsOfAccountSettingsTemplateOptionsModel).execute(); + // Invoke createMfaReport() with a valid options model and verify the result + Response response = iamIdentityService.createMfaReport(createMfaReportOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateList responseObj = response.getResult(); + ReportReference responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listVersionsOfAccountSettingsTemplatePath); + assertEquals(parsedPath, createMfaReportPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(query.get("limit"), "20"); - assertEquals(query.get("pagetoken"), "testString"); - assertEquals(query.get("sort"), "created_at"); - assertEquals(query.get("order"), "asc"); - assertEquals(query.get("include_history"), "false"); + assertEquals(query.get("type"), "testString"); } - // Test the listVersionsOfAccountSettingsTemplate operation with and without retries enabled + // Test the createMfaReport operation with and without retries enabled @Test - public void testListVersionsOfAccountSettingsTemplateWRetries() throws Throwable { + public void testCreateMfaReportWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListVersionsOfAccountSettingsTemplateWOptions(); + testCreateMfaReportWOptions(); iamIdentityService.disableRetries(); - testListVersionsOfAccountSettingsTemplateWOptions(); + testCreateMfaReportWOptions(); } - // Test the listVersionsOfAccountSettingsTemplate operation with a null options model (negative test) + // Test the createMfaReport operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListVersionsOfAccountSettingsTemplateNoOptions() throws Throwable { + public void testCreateMfaReportNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.listVersionsOfAccountSettingsTemplate(null).execute(); + iamIdentityService.createMfaReport(null).execute(); } - // Test the createAccountSettingsTemplateVersion operation with a valid options model parameter + // Test the getMfaReport operation with a valid options model parameter @Test - public void testCreateAccountSettingsTemplateVersionWOptions() throws Throwable { + public void testGetMfaReportWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String createAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions"; + String mockResponseBody = "{\"created_by\": \"createdBy\", \"reference\": \"reference\", \"report_time\": \"reportTime\", \"account_id\": \"accountId\", \"ims_account_id\": \"imsAccountId\", \"users\": [{\"iam_id\": \"iamId\", \"name\": \"name\", \"username\": \"username\", \"email\": \"email\", \"enrollments\": {\"effective_mfa_type\": \"effectiveMfaType\", \"id_based_mfa\": {\"trait_account_default\": \"NONE\", \"trait_user_specific\": \"NONE\", \"trait_effective\": \"NONE\", \"complies\": true, \"comply_state\": \"NO\"}, \"account_based_mfa\": {\"security_questions\": {\"required\": true, \"enrolled\": true}, \"totp\": {\"required\": true, \"enrolled\": true}, \"verisign\": {\"required\": true, \"enrolled\": true}, \"complies\": true}}}]}"; + String getMfaReportPath = "/v1/mfa/accounts/testString/report/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the AccountSettingsUserMFA model - AccountSettingsUserMFA accountSettingsUserMfaModel = new AccountSettingsUserMFA.Builder() - .iamId("testString") - .mfa("NONE") - .build(); - - // Construct an instance of the AccountSettingsComponent model - AccountSettingsComponent accountSettingsComponentModel = new AccountSettingsComponent.Builder() - .restrictCreateServiceId("NOT_SET") - .restrictCreatePlatformApikey("NOT_SET") - .allowedIpAddresses("testString") - .mfa("NONE") - .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) - .sessionExpirationInSeconds("86400") - .sessionInvalidationInSeconds("7200") - .maxSessionsPerIdentity("testString") - .systemAccessTokenExpirationInSeconds("3600") - .systemRefreshTokenExpirationInSeconds("259200") - .build(); - - // Construct an instance of the CreateAccountSettingsTemplateVersionOptions model - CreateAccountSettingsTemplateVersionOptions createAccountSettingsTemplateVersionOptionsModel = new CreateAccountSettingsTemplateVersionOptions.Builder() - .templateId("testString") + // Construct an instance of the GetMfaReportOptions model + GetMfaReportOptions getMfaReportOptionsModel = new GetMfaReportOptions.Builder() .accountId("testString") - .name("testString") - .description("testString") - .accountSettings(accountSettingsComponentModel) + .reference("testString") .build(); - // Invoke createAccountSettingsTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.createAccountSettingsTemplateVersion(createAccountSettingsTemplateVersionOptionsModel).execute(); + // Invoke getMfaReport() with a valid options model and verify the result + Response response = iamIdentityService.getMfaReport(getMfaReportOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateResponse responseObj = response.getResult(); + ReportMfaEnrollmentStatus responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createAccountSettingsTemplateVersionPath); + assertEquals(parsedPath, getMfaReportPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createAccountSettingsTemplateVersion operation with and without retries enabled + // Test the getMfaReport operation with and without retries enabled @Test - public void testCreateAccountSettingsTemplateVersionWRetries() throws Throwable { + public void testGetMfaReportWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateAccountSettingsTemplateVersionWOptions(); + testGetMfaReportWOptions(); iamIdentityService.disableRetries(); - testCreateAccountSettingsTemplateVersionWOptions(); + testGetMfaReportWOptions(); } - // Test the createAccountSettingsTemplateVersion operation with a null options model (negative test) + // Test the getMfaReport operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateAccountSettingsTemplateVersionNoOptions() throws Throwable { + public void testGetMfaReportNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createAccountSettingsTemplateVersion(null).execute(); + iamIdentityService.getMfaReport(null).execute(); } - // Test the getAccountSettingsTemplateVersion operation with a valid options model parameter + // Test the updatePreferenceOnScopeAccount operation with a valid options model parameter @Test - public void testGetAccountSettingsTemplateVersionWOptions() throws Throwable { + public void testUpdatePreferenceOnScopeAccountWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions/testString"; + String mockResponseBody = "{\"service\": \"service\", \"id\": \"id\", \"account_id\": \"accountId\", \"scope\": \"scope\", \"value_string\": \"valueString\", \"value_list_of_strings\": [\"valueListOfStrings\"]}"; + String updatePreferenceOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString/testString/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetAccountSettingsTemplateVersionOptions model - GetAccountSettingsTemplateVersionOptions getAccountSettingsTemplateVersionOptionsModel = new GetAccountSettingsTemplateVersionOptions.Builder() - .templateId("testString") - .version("testString") - .includeHistory(false) + // Construct an instance of the UpdatePreferenceOnScopeAccountOptions model + UpdatePreferenceOnScopeAccountOptions updatePreferenceOnScopeAccountOptionsModel = new UpdatePreferenceOnScopeAccountOptions.Builder() + .accountId("testString") + .iamId("testString") + .service("testString") + .preferenceId("testString") + .valueString("testString") + .valueListOfStrings(java.util.Arrays.asList("testString")) .build(); - // Invoke getAccountSettingsTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.getAccountSettingsTemplateVersion(getAccountSettingsTemplateVersionOptionsModel).execute(); + // Invoke updatePreferenceOnScopeAccount() with a valid options model and verify the result + Response response = iamIdentityService.updatePreferenceOnScopeAccount(updatePreferenceOnScopeAccountOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateResponse responseObj = response.getResult(); + IdentityPreferenceResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getAccountSettingsTemplateVersionPath); - // Verify query params + assertEquals(parsedPath, updatePreferenceOnScopeAccountPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertNull(query); } - // Test the getAccountSettingsTemplateVersion operation with and without retries enabled + // Test the updatePreferenceOnScopeAccount operation with and without retries enabled @Test - public void testGetAccountSettingsTemplateVersionWRetries() throws Throwable { + public void testUpdatePreferenceOnScopeAccountWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetAccountSettingsTemplateVersionWOptions(); + testUpdatePreferenceOnScopeAccountWOptions(); iamIdentityService.disableRetries(); - testGetAccountSettingsTemplateVersionWOptions(); + testUpdatePreferenceOnScopeAccountWOptions(); } - // Test the getAccountSettingsTemplateVersion operation with a null options model (negative test) + // Test the updatePreferenceOnScopeAccount operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetAccountSettingsTemplateVersionNoOptions() throws Throwable { + public void testUpdatePreferenceOnScopeAccountNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getAccountSettingsTemplateVersion(null).execute(); + iamIdentityService.updatePreferenceOnScopeAccount(null).execute(); } - // Test the updateAccountSettingsTemplateVersion operation with a valid options model parameter + // Test the deletePreferencesOnScopeAccount operation with a valid options model parameter @Test - public void testUpdateAccountSettingsTemplateVersionWOptions() throws Throwable { + public void testDeletePreferencesOnScopeAccountWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String updateAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions/testString"; + String mockResponseBody = ""; + String deletePreferencesOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString/testString/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the AccountSettingsUserMFA model - AccountSettingsUserMFA accountSettingsUserMfaModel = new AccountSettingsUserMFA.Builder() - .iamId("testString") - .mfa("NONE") - .build(); - - // Construct an instance of the AccountSettingsComponent model - AccountSettingsComponent accountSettingsComponentModel = new AccountSettingsComponent.Builder() - .restrictCreateServiceId("NOT_SET") - .restrictCreatePlatformApikey("NOT_SET") - .allowedIpAddresses("testString") - .mfa("NONE") - .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) - .sessionExpirationInSeconds("86400") - .sessionInvalidationInSeconds("7200") - .maxSessionsPerIdentity("testString") - .systemAccessTokenExpirationInSeconds("3600") - .systemRefreshTokenExpirationInSeconds("259200") - .build(); - - // Construct an instance of the UpdateAccountSettingsTemplateVersionOptions model - UpdateAccountSettingsTemplateVersionOptions updateAccountSettingsTemplateVersionOptionsModel = new UpdateAccountSettingsTemplateVersionOptions.Builder() - .ifMatch("testString") - .templateId("testString") - .version("testString") + // Construct an instance of the DeletePreferencesOnScopeAccountOptions model + DeletePreferencesOnScopeAccountOptions deletePreferencesOnScopeAccountOptionsModel = new DeletePreferencesOnScopeAccountOptions.Builder() .accountId("testString") - .name("testString") - .description("testString") - .accountSettings(accountSettingsComponentModel) + .iamId("testString") + .service("testString") + .preferenceId("testString") .build(); - // Invoke updateAccountSettingsTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.updateAccountSettingsTemplateVersion(updateAccountSettingsTemplateVersionOptionsModel).execute(); + // Invoke deletePreferencesOnScopeAccount() with a valid options model and verify the result + Response response = iamIdentityService.deletePreferencesOnScopeAccount(deletePreferencesOnScopeAccountOptionsModel).execute(); assertNotNull(response); - AccountSettingsTemplateResponse responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateAccountSettingsTemplateVersionPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, deletePreferencesOnScopeAccountPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updateAccountSettingsTemplateVersion operation with and without retries enabled + // Test the deletePreferencesOnScopeAccount operation with and without retries enabled @Test - public void testUpdateAccountSettingsTemplateVersionWRetries() throws Throwable { + public void testDeletePreferencesOnScopeAccountWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateAccountSettingsTemplateVersionWOptions(); + testDeletePreferencesOnScopeAccountWOptions(); iamIdentityService.disableRetries(); - testUpdateAccountSettingsTemplateVersionWOptions(); + testDeletePreferencesOnScopeAccountWOptions(); } - // Test the updateAccountSettingsTemplateVersion operation with a null options model (negative test) + // Test the deletePreferencesOnScopeAccount operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateAccountSettingsTemplateVersionNoOptions() throws Throwable { + public void testDeletePreferencesOnScopeAccountNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateAccountSettingsTemplateVersion(null).execute(); + iamIdentityService.deletePreferencesOnScopeAccount(null).execute(); } - // Test the deleteAccountSettingsTemplateVersion operation with a valid options model parameter + // Test the getPreferencesOnScopeAccount operation with a valid options model parameter @Test - public void testDeleteAccountSettingsTemplateVersionWOptions() throws Throwable { + public void testGetPreferencesOnScopeAccountWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions/testString"; + String mockResponseBody = "{\"service\": \"service\", \"id\": \"id\", \"account_id\": \"accountId\", \"scope\": \"scope\", \"value_string\": \"valueString\", \"value_list_of_strings\": [\"valueListOfStrings\"]}"; + String getPreferencesOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString/testString/testString"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteAccountSettingsTemplateVersionOptions model - DeleteAccountSettingsTemplateVersionOptions deleteAccountSettingsTemplateVersionOptionsModel = new DeleteAccountSettingsTemplateVersionOptions.Builder() - .templateId("testString") - .version("testString") + // Construct an instance of the GetPreferencesOnScopeAccountOptions model + GetPreferencesOnScopeAccountOptions getPreferencesOnScopeAccountOptionsModel = new GetPreferencesOnScopeAccountOptions.Builder() + .accountId("testString") + .iamId("testString") + .service("testString") + .preferenceId("testString") .build(); - // Invoke deleteAccountSettingsTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.deleteAccountSettingsTemplateVersion(deleteAccountSettingsTemplateVersionOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + // Invoke getPreferencesOnScopeAccount() with a valid options model and verify the result + Response response = iamIdentityService.getPreferencesOnScopeAccount(getPreferencesOnScopeAccountOptionsModel).execute(); + assertNotNull(response); + IdentityPreferenceResponse responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteAccountSettingsTemplateVersionPath); + assertEquals(parsedPath, getPreferencesOnScopeAccountPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteAccountSettingsTemplateVersion operation with and without retries enabled + // Test the getPreferencesOnScopeAccount operation with and without retries enabled @Test - public void testDeleteAccountSettingsTemplateVersionWRetries() throws Throwable { + public void testGetPreferencesOnScopeAccountWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteAccountSettingsTemplateVersionWOptions(); + testGetPreferencesOnScopeAccountWOptions(); iamIdentityService.disableRetries(); - testDeleteAccountSettingsTemplateVersionWOptions(); + testGetPreferencesOnScopeAccountWOptions(); } - // Test the deleteAccountSettingsTemplateVersion operation with a null options model (negative test) + // Test the getPreferencesOnScopeAccount operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteAccountSettingsTemplateVersionNoOptions() throws Throwable { + public void testGetPreferencesOnScopeAccountNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteAccountSettingsTemplateVersion(null).execute(); + iamIdentityService.getPreferencesOnScopeAccount(null).execute(); } - // Test the commitAccountSettingsTemplate operation with a valid options model parameter + // Test the getAllPreferencesOnScopeAccount operation with a valid options model parameter @Test - public void testCommitAccountSettingsTemplateWOptions() throws Throwable { + public void testGetAllPreferencesOnScopeAccountWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String commitAccountSettingsTemplatePath = "/v1/account_settings_templates/testString/versions/testString/commit"; + String mockResponseBody = "{\"preferences\": [{\"service\": \"service\", \"id\": \"id\", \"account_id\": \"accountId\", \"scope\": \"scope\", \"value_string\": \"valueString\", \"value_list_of_strings\": [\"valueListOfStrings\"]}]}"; + String getAllPreferencesOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CommitAccountSettingsTemplateOptions model - CommitAccountSettingsTemplateOptions commitAccountSettingsTemplateOptionsModel = new CommitAccountSettingsTemplateOptions.Builder() - .templateId("testString") - .version("testString") + // Construct an instance of the GetAllPreferencesOnScopeAccountOptions model + GetAllPreferencesOnScopeAccountOptions getAllPreferencesOnScopeAccountOptionsModel = new GetAllPreferencesOnScopeAccountOptions.Builder() + .accountId("testString") + .iamId("testString") .build(); - // Invoke commitAccountSettingsTemplate() with a valid options model and verify the result - Response response = iamIdentityService.commitAccountSettingsTemplate(commitAccountSettingsTemplateOptionsModel).execute(); + // Invoke getAllPreferencesOnScopeAccount() with a valid options model and verify the result + Response response = iamIdentityService.getAllPreferencesOnScopeAccount(getAllPreferencesOnScopeAccountOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + IdentityPreferencesResponse responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, commitAccountSettingsTemplatePath); + assertEquals(parsedPath, getAllPreferencesOnScopeAccountPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the commitAccountSettingsTemplate operation with and without retries enabled + // Test the getAllPreferencesOnScopeAccount operation with and without retries enabled @Test - public void testCommitAccountSettingsTemplateWRetries() throws Throwable { + public void testGetAllPreferencesOnScopeAccountWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCommitAccountSettingsTemplateWOptions(); + testGetAllPreferencesOnScopeAccountWOptions(); iamIdentityService.disableRetries(); - testCommitAccountSettingsTemplateWOptions(); + testGetAllPreferencesOnScopeAccountWOptions(); } - // Test the commitAccountSettingsTemplate operation with a null options model (negative test) + // Test the getAllPreferencesOnScopeAccount operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitAccountSettingsTemplateNoOptions() throws Throwable { + public void testGetAllPreferencesOnScopeAccountNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.commitAccountSettingsTemplate(null).execute(); + iamIdentityService.getAllPreferencesOnScopeAccount(null).execute(); } - // Test the createReport operation with a valid options model parameter + // Test the listProfileTemplates operation with a valid options model parameter @Test - public void testCreateReportWOptions() throws Throwable { + public void testListProfileTemplatesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"reference\": \"reference\"}"; - String createReportPath = "/v1/activity/accounts/testString/report"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"profile_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listProfileTemplatesPath = "/v1/profile_templates"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(202) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CreateReportOptions model - CreateReportOptions createReportOptionsModel = new CreateReportOptions.Builder() + // Construct an instance of the ListProfileTemplatesOptions model + ListProfileTemplatesOptions listProfileTemplatesOptionsModel = new ListProfileTemplatesOptions.Builder() .accountId("testString") - .type("inactive") - .duration("720") + .limit("20") + .pagetoken("testString") + .sort("created_at") + .order("asc") + .includeHistory("false") .build(); - // Invoke createReport() with a valid options model and verify the result - Response response = iamIdentityService.createReport(createReportOptionsModel).execute(); + // Invoke listProfileTemplates() with a valid options model and verify the result + Response response = iamIdentityService.listProfileTemplates(listProfileTemplatesOptionsModel).execute(); assertNotNull(response); - ReportReference responseObj = response.getResult(); + TrustedProfileTemplateList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createReportPath); + assertEquals(parsedPath, listProfileTemplatesPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(query.get("type"), "inactive"); - assertEquals(query.get("duration"), "720"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("limit"), "20"); + assertEquals(query.get("pagetoken"), "testString"); + assertEquals(query.get("sort"), "created_at"); + assertEquals(query.get("order"), "asc"); + assertEquals(query.get("include_history"), "false"); } - // Test the createReport operation with and without retries enabled + // Test the listProfileTemplates operation with and without retries enabled @Test - public void testCreateReportWRetries() throws Throwable { + public void testListProfileTemplatesWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateReportWOptions(); + testListProfileTemplatesWOptions(); iamIdentityService.disableRetries(); - testCreateReportWOptions(); - } - - // Test the createReport operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateReportNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamIdentityService.createReport(null).execute(); + testListProfileTemplatesWOptions(); } - // Test the getReport operation with a valid options model parameter + // Test the createProfileTemplate operation with a valid options model parameter @Test - public void testGetReportWOptions() throws Throwable { + public void testCreateProfileTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"created_by\": \"createdBy\", \"reference\": \"reference\", \"report_duration\": \"reportDuration\", \"report_start_time\": \"reportStartTime\", \"report_end_time\": \"reportEndTime\", \"users\": [{\"iam_id\": \"iamId\", \"name\": \"name\", \"username\": \"username\", \"email\": \"email\", \"last_authn\": \"lastAuthn\"}], \"apikeys\": [{\"id\": \"id\", \"name\": \"name\", \"type\": \"type\", \"serviceid\": {\"id\": \"id\", \"name\": \"name\"}, \"user\": {\"iam_id\": \"iamId\", \"name\": \"name\", \"username\": \"username\", \"email\": \"email\"}, \"last_authn\": \"lastAuthn\"}], \"serviceids\": [{\"id\": \"id\", \"name\": \"name\", \"last_authn\": \"lastAuthn\"}], \"profiles\": [{\"id\": \"id\", \"name\": \"name\", \"last_authn\": \"lastAuthn\"}]}"; - String getReportPath = "/v1/activity/accounts/testString/report/testString"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String createProfileTemplatePath = "/v1/profile_templates"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the GetReportOptions model - GetReportOptions getReportOptionsModel = new GetReportOptions.Builder() + // Construct an instance of the ProfileClaimRuleConditions model + ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() + .claim("testString") + .operator("testString") + .value("testString") + .build(); + + // Construct an instance of the TrustedProfileTemplateClaimRule model + TrustedProfileTemplateClaimRule trustedProfileTemplateClaimRuleModel = new TrustedProfileTemplateClaimRule.Builder() + .name("testString") + .type("Profile-SAML") + .realmName("testString") + .expiration(Long.valueOf("26")) + .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) + .build(); + + // Construct an instance of the ProfileIdentityRequest model + ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() + .identifier("testString") + .type("user") + .accounts(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Construct an instance of the TemplateProfileComponentRequest model + TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() + .name("testString") + .description("testString") + .email("testString") + .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) + .identities(java.util.Arrays.asList(profileIdentityRequestModel)) + .build(); + + // Construct an instance of the PolicyTemplateReference model + PolicyTemplateReference policyTemplateReferenceModel = new PolicyTemplateReference.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the ActionControlsIdentities model + ActionControlsIdentities actionControlsIdentitiesModel = new ActionControlsIdentities.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControlsRules model + ActionControlsRules actionControlsRulesModel = new ActionControlsRules.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControlsPolicies model + ActionControlsPolicies actionControlsPoliciesModel = new ActionControlsPolicies.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControls model + ActionControls actionControlsModel = new ActionControls.Builder() + .identities(actionControlsIdentitiesModel) + .rules(actionControlsRulesModel) + .policies(actionControlsPoliciesModel) + .build(); + + // Construct an instance of the CreateProfileTemplateOptions model + CreateProfileTemplateOptions createProfileTemplateOptionsModel = new CreateProfileTemplateOptions.Builder() .accountId("testString") - .reference("testString") + .name("testString") + .description("testString") + .profile(templateProfileComponentRequestModel) + .policyTemplateReferences(java.util.Arrays.asList(policyTemplateReferenceModel)) + .actionControls(actionControlsModel) .build(); - // Invoke getReport() with a valid options model and verify the result - Response response = iamIdentityService.getReport(getReportOptionsModel).execute(); + // Invoke createProfileTemplate() with a valid options model and verify the result + Response response = iamIdentityService.createProfileTemplate(createProfileTemplateOptionsModel).execute(); assertNotNull(response); - Report responseObj = response.getResult(); + TrustedProfileTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getReportPath); + assertEquals(parsedPath, createProfileTemplatePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getReport operation with and without retries enabled + // Test the createProfileTemplate operation with and without retries enabled @Test - public void testGetReportWRetries() throws Throwable { + public void testCreateProfileTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetReportWOptions(); + testCreateProfileTemplateWOptions(); iamIdentityService.disableRetries(); - testGetReportWOptions(); - } - - // Test the getReport operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetReportNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamIdentityService.getReport(null).execute(); + testCreateProfileTemplateWOptions(); } - // Test the getEffectiveAccountSettings operation with a valid options model parameter + // Test the getLatestProfileTemplateVersion operation with a valid options model parameter @Test - public void testGetEffectiveAccountSettingsWOptions() throws Throwable { + public void testGetLatestProfileTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"account_id\": \"accountId\", \"effective\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\", \"name\": \"name\", \"userName\": \"userName\", \"email\": \"email\", \"description\": \"description\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"account\": {\"account_id\": \"accountId\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\", \"name\": \"name\", \"userName\": \"userName\", \"email\": \"email\", \"description\": \"description\"}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"assigned_templates\": [{\"template_id\": \"templateId\", \"template_version\": 15, \"template_name\": \"templateName\", \"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\", \"name\": \"name\", \"userName\": \"userName\", \"email\": \"email\", \"description\": \"description\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}]}"; - String getEffectiveAccountSettingsPath = "/v1/accounts/testString/effective_settings/identity"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getLatestProfileTemplateVersionPath = "/v1/profile_templates/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetEffectiveAccountSettingsOptions model - GetEffectiveAccountSettingsOptions getEffectiveAccountSettingsOptionsModel = new GetEffectiveAccountSettingsOptions.Builder() - .accountId("testString") + // Construct an instance of the GetLatestProfileTemplateVersionOptions model + GetLatestProfileTemplateVersionOptions getLatestProfileTemplateVersionOptionsModel = new GetLatestProfileTemplateVersionOptions.Builder() + .templateId("testString") .includeHistory(false) - .resolveUserMfa(false) .build(); - // Invoke getEffectiveAccountSettings() with a valid options model and verify the result - Response response = iamIdentityService.getEffectiveAccountSettings(getEffectiveAccountSettingsOptionsModel).execute(); + // Invoke getLatestProfileTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.getLatestProfileTemplateVersion(getLatestProfileTemplateVersionOptionsModel).execute(); assertNotNull(response); - EffectiveAccountSettingsResponse responseObj = response.getResult(); + TrustedProfileTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -3486,215 +3328,284 @@ public void testGetEffectiveAccountSettingsWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getEffectiveAccountSettingsPath); + assertEquals(parsedPath, getLatestProfileTemplateVersionPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); - assertEquals(Boolean.valueOf(query.get("resolve_user_mfa")), Boolean.valueOf(false)); } - // Test the getEffectiveAccountSettings operation with and without retries enabled + // Test the getLatestProfileTemplateVersion operation with and without retries enabled @Test - public void testGetEffectiveAccountSettingsWRetries() throws Throwable { + public void testGetLatestProfileTemplateVersionWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetEffectiveAccountSettingsWOptions(); + testGetLatestProfileTemplateVersionWOptions(); iamIdentityService.disableRetries(); - testGetEffectiveAccountSettingsWOptions(); + testGetLatestProfileTemplateVersionWOptions(); } - // Test the getEffectiveAccountSettings operation with a null options model (negative test) + // Test the getLatestProfileTemplateVersion operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetEffectiveAccountSettingsNoOptions() throws Throwable { + public void testGetLatestProfileTemplateVersionNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getEffectiveAccountSettings(null).execute(); + iamIdentityService.getLatestProfileTemplateVersion(null).execute(); } - // Test the updatePreferenceOnScopeAccount operation with a valid options model parameter + // Test the deleteAllVersionsOfProfileTemplate operation with a valid options model parameter @Test - public void testUpdatePreferenceOnScopeAccountWOptions() throws Throwable { + public void testDeleteAllVersionsOfProfileTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"service\": \"service\", \"id\": \"id\", \"account_id\": \"accountId\", \"scope\": \"scope\", \"value_string\": \"valueString\", \"value_list_of_strings\": [\"valueListOfStrings\"]}"; - String updatePreferenceOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString/testString/testString"; + String mockResponseBody = ""; + String deleteAllVersionsOfProfileTemplatePath = "/v1/profile_templates/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the UpdatePreferenceOnScopeAccountOptions model - UpdatePreferenceOnScopeAccountOptions updatePreferenceOnScopeAccountOptionsModel = new UpdatePreferenceOnScopeAccountOptions.Builder() - .accountId("testString") - .iamId("testString") - .service("testString") - .preferenceId("testString") - .valueString("testString") - .valueListOfStrings(java.util.Arrays.asList("testString")) + // Construct an instance of the DeleteAllVersionsOfProfileTemplateOptions model + DeleteAllVersionsOfProfileTemplateOptions deleteAllVersionsOfProfileTemplateOptionsModel = new DeleteAllVersionsOfProfileTemplateOptions.Builder() + .templateId("testString") .build(); - // Invoke updatePreferenceOnScopeAccount() with a valid options model and verify the result - Response response = iamIdentityService.updatePreferenceOnScopeAccount(updatePreferenceOnScopeAccountOptionsModel).execute(); + // Invoke deleteAllVersionsOfProfileTemplate() with a valid options model and verify the result + Response response = iamIdentityService.deleteAllVersionsOfProfileTemplate(deleteAllVersionsOfProfileTemplateOptionsModel).execute(); assertNotNull(response); - IdentityPreferenceResponse responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePreferenceOnScopeAccountPath); + assertEquals(parsedPath, deleteAllVersionsOfProfileTemplatePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updatePreferenceOnScopeAccount operation with and without retries enabled + // Test the deleteAllVersionsOfProfileTemplate operation with and without retries enabled @Test - public void testUpdatePreferenceOnScopeAccountWRetries() throws Throwable { + public void testDeleteAllVersionsOfProfileTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdatePreferenceOnScopeAccountWOptions(); + testDeleteAllVersionsOfProfileTemplateWOptions(); iamIdentityService.disableRetries(); - testUpdatePreferenceOnScopeAccountWOptions(); + testDeleteAllVersionsOfProfileTemplateWOptions(); } - // Test the updatePreferenceOnScopeAccount operation with a null options model (negative test) + // Test the deleteAllVersionsOfProfileTemplate operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePreferenceOnScopeAccountNoOptions() throws Throwable { + public void testDeleteAllVersionsOfProfileTemplateNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updatePreferenceOnScopeAccount(null).execute(); + iamIdentityService.deleteAllVersionsOfProfileTemplate(null).execute(); } - // Test the deletePreferencesOnScopeAccount operation with a valid options model parameter + // Test the listVersionsOfProfileTemplate operation with a valid options model parameter @Test - public void testDeletePreferencesOnScopeAccountWOptions() throws Throwable { + public void testListVersionsOfProfileTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deletePreferencesOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString/testString/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"profile_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listVersionsOfProfileTemplatePath = "/v1/profile_templates/testString/versions"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeletePreferencesOnScopeAccountOptions model - DeletePreferencesOnScopeAccountOptions deletePreferencesOnScopeAccountOptionsModel = new DeletePreferencesOnScopeAccountOptions.Builder() - .accountId("testString") - .iamId("testString") - .service("testString") - .preferenceId("testString") + // Construct an instance of the ListVersionsOfProfileTemplateOptions model + ListVersionsOfProfileTemplateOptions listVersionsOfProfileTemplateOptionsModel = new ListVersionsOfProfileTemplateOptions.Builder() + .templateId("testString") + .limit("20") + .pagetoken("testString") + .sort("created_at") + .order("asc") + .includeHistory("false") .build(); - // Invoke deletePreferencesOnScopeAccount() with a valid options model and verify the result - Response response = iamIdentityService.deletePreferencesOnScopeAccount(deletePreferencesOnScopeAccountOptionsModel).execute(); + // Invoke listVersionsOfProfileTemplate() with a valid options model and verify the result + Response response = iamIdentityService.listVersionsOfProfileTemplate(listVersionsOfProfileTemplateOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + TrustedProfileTemplateList responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deletePreferencesOnScopeAccountPath); - // Verify that there is no query string + assertEquals(parsedPath, listVersionsOfProfileTemplatePath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("limit"), "20"); + assertEquals(query.get("pagetoken"), "testString"); + assertEquals(query.get("sort"), "created_at"); + assertEquals(query.get("order"), "asc"); + assertEquals(query.get("include_history"), "false"); } - // Test the deletePreferencesOnScopeAccount operation with and without retries enabled + // Test the listVersionsOfProfileTemplate operation with and without retries enabled @Test - public void testDeletePreferencesOnScopeAccountWRetries() throws Throwable { + public void testListVersionsOfProfileTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeletePreferencesOnScopeAccountWOptions(); + testListVersionsOfProfileTemplateWOptions(); iamIdentityService.disableRetries(); - testDeletePreferencesOnScopeAccountWOptions(); + testListVersionsOfProfileTemplateWOptions(); } - // Test the deletePreferencesOnScopeAccount operation with a null options model (negative test) + // Test the listVersionsOfProfileTemplate operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePreferencesOnScopeAccountNoOptions() throws Throwable { + public void testListVersionsOfProfileTemplateNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deletePreferencesOnScopeAccount(null).execute(); + iamIdentityService.listVersionsOfProfileTemplate(null).execute(); } - // Test the getPreferencesOnScopeAccount operation with a valid options model parameter + // Test the createProfileTemplateVersion operation with a valid options model parameter @Test - public void testGetPreferencesOnScopeAccountWOptions() throws Throwable { + public void testCreateProfileTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"service\": \"service\", \"id\": \"id\", \"account_id\": \"accountId\", \"scope\": \"scope\", \"value_string\": \"valueString\", \"value_list_of_strings\": [\"valueListOfStrings\"]}"; - String getPreferencesOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString/testString/testString"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String createProfileTemplateVersionPath = "/v1/profile_templates/testString/versions"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the GetPreferencesOnScopeAccountOptions model - GetPreferencesOnScopeAccountOptions getPreferencesOnScopeAccountOptionsModel = new GetPreferencesOnScopeAccountOptions.Builder() + // Construct an instance of the ProfileClaimRuleConditions model + ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() + .claim("testString") + .operator("testString") + .value("testString") + .build(); + + // Construct an instance of the TrustedProfileTemplateClaimRule model + TrustedProfileTemplateClaimRule trustedProfileTemplateClaimRuleModel = new TrustedProfileTemplateClaimRule.Builder() + .name("testString") + .type("Profile-SAML") + .realmName("testString") + .expiration(Long.valueOf("26")) + .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) + .build(); + + // Construct an instance of the ProfileIdentityRequest model + ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() + .identifier("testString") + .type("user") + .accounts(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Construct an instance of the TemplateProfileComponentRequest model + TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() + .name("testString") + .description("testString") + .email("testString") + .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) + .identities(java.util.Arrays.asList(profileIdentityRequestModel)) + .build(); + + // Construct an instance of the PolicyTemplateReference model + PolicyTemplateReference policyTemplateReferenceModel = new PolicyTemplateReference.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the ActionControlsIdentities model + ActionControlsIdentities actionControlsIdentitiesModel = new ActionControlsIdentities.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControlsRules model + ActionControlsRules actionControlsRulesModel = new ActionControlsRules.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControlsPolicies model + ActionControlsPolicies actionControlsPoliciesModel = new ActionControlsPolicies.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControls model + ActionControls actionControlsModel = new ActionControls.Builder() + .identities(actionControlsIdentitiesModel) + .rules(actionControlsRulesModel) + .policies(actionControlsPoliciesModel) + .build(); + + // Construct an instance of the CreateProfileTemplateVersionOptions model + CreateProfileTemplateVersionOptions createProfileTemplateVersionOptionsModel = new CreateProfileTemplateVersionOptions.Builder() + .templateId("testString") .accountId("testString") - .iamId("testString") - .service("testString") - .preferenceId("testString") + .name("testString") + .description("testString") + .profile(templateProfileComponentRequestModel) + .policyTemplateReferences(java.util.Arrays.asList(policyTemplateReferenceModel)) + .actionControls(actionControlsModel) .build(); - // Invoke getPreferencesOnScopeAccount() with a valid options model and verify the result - Response response = iamIdentityService.getPreferencesOnScopeAccount(getPreferencesOnScopeAccountOptionsModel).execute(); + // Invoke createProfileTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.createProfileTemplateVersion(createProfileTemplateVersionOptionsModel).execute(); assertNotNull(response); - IdentityPreferenceResponse responseObj = response.getResult(); + TrustedProfileTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getPreferencesOnScopeAccountPath); + assertEquals(parsedPath, createProfileTemplateVersionPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getPreferencesOnScopeAccount operation with and without retries enabled + // Test the createProfileTemplateVersion operation with and without retries enabled @Test - public void testGetPreferencesOnScopeAccountWRetries() throws Throwable { + public void testCreateProfileTemplateVersionWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetPreferencesOnScopeAccountWOptions(); + testCreateProfileTemplateVersionWOptions(); iamIdentityService.disableRetries(); - testGetPreferencesOnScopeAccountWOptions(); + testCreateProfileTemplateVersionWOptions(); } - // Test the getPreferencesOnScopeAccount operation with a null options model (negative test) + // Test the createProfileTemplateVersion operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPreferencesOnScopeAccountNoOptions() throws Throwable { + public void testCreateProfileTemplateVersionNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getPreferencesOnScopeAccount(null).execute(); + iamIdentityService.createProfileTemplateVersion(null).execute(); } - // Test the getAllPreferencesOnScopeAccount operation with a valid options model parameter + // Test the getProfileTemplateVersion operation with a valid options model parameter @Test - public void testGetAllPreferencesOnScopeAccountWOptions() throws Throwable { + public void testGetProfileTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"preferences\": [{\"service\": \"service\", \"id\": \"id\", \"account_id\": \"accountId\", \"scope\": \"scope\", \"value_string\": \"valueString\", \"value_list_of_strings\": [\"valueListOfStrings\"]}]}"; - String getAllPreferencesOnScopeAccountPath = "/v1/preferences/accounts/testString/identities/testString"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getProfileTemplateVersionPath = "/v1/profile_templates/testString/versions/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetAllPreferencesOnScopeAccountOptions model - GetAllPreferencesOnScopeAccountOptions getAllPreferencesOnScopeAccountOptionsModel = new GetAllPreferencesOnScopeAccountOptions.Builder() - .accountId("testString") - .iamId("testString") + // Construct an instance of the GetProfileTemplateVersionOptions model + GetProfileTemplateVersionOptions getProfileTemplateVersionOptionsModel = new GetProfileTemplateVersionOptions.Builder() + .templateId("testString") + .version("testString") + .includeHistory(false) .build(); - // Invoke getAllPreferencesOnScopeAccount() with a valid options model and verify the result - Response response = iamIdentityService.getAllPreferencesOnScopeAccount(getAllPreferencesOnScopeAccountOptionsModel).execute(); + // Invoke getProfileTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.getProfileTemplateVersion(getProfileTemplateVersionOptionsModel).execute(); assertNotNull(response); - AllIdentityPreferencesResponse responseObj = response.getResult(); + TrustedProfileTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -3703,27 +3614,255 @@ public void testGetAllPreferencesOnScopeAccountWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getAllPreferencesOnScopeAccountPath); - // Verify that there is no query string + assertEquals(parsedPath, getProfileTemplateVersionPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); } - // Test the getAllPreferencesOnScopeAccount operation with and without retries enabled + // Test the getProfileTemplateVersion operation with and without retries enabled @Test - public void testGetAllPreferencesOnScopeAccountWRetries() throws Throwable { + public void testGetProfileTemplateVersionWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetAllPreferencesOnScopeAccountWOptions(); + testGetProfileTemplateVersionWOptions(); iamIdentityService.disableRetries(); - testGetAllPreferencesOnScopeAccountWOptions(); + testGetProfileTemplateVersionWOptions(); } - // Test the getAllPreferencesOnScopeAccount operation with a null options model (negative test) + // Test the getProfileTemplateVersion operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetAllPreferencesOnScopeAccountNoOptions() throws Throwable { + public void testGetProfileTemplateVersionNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getAllPreferencesOnScopeAccount(null).execute(); + iamIdentityService.getProfileTemplateVersion(null).execute(); + } + + // Test the updateProfileTemplateVersion operation with a valid options model parameter + @Test + public void testUpdateProfileTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"email\": \"email\", \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String updateProfileTemplateVersionPath = "/v1/profile_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ProfileClaimRuleConditions model + ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() + .claim("testString") + .operator("testString") + .value("testString") + .build(); + + // Construct an instance of the TrustedProfileTemplateClaimRule model + TrustedProfileTemplateClaimRule trustedProfileTemplateClaimRuleModel = new TrustedProfileTemplateClaimRule.Builder() + .name("testString") + .type("Profile-SAML") + .realmName("testString") + .expiration(Long.valueOf("26")) + .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) + .build(); + + // Construct an instance of the ProfileIdentityRequest model + ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() + .identifier("testString") + .type("user") + .accounts(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Construct an instance of the TemplateProfileComponentRequest model + TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() + .name("testString") + .description("testString") + .email("testString") + .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) + .identities(java.util.Arrays.asList(profileIdentityRequestModel)) + .build(); + + // Construct an instance of the PolicyTemplateReference model + PolicyTemplateReference policyTemplateReferenceModel = new PolicyTemplateReference.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the ActionControlsIdentities model + ActionControlsIdentities actionControlsIdentitiesModel = new ActionControlsIdentities.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControlsRules model + ActionControlsRules actionControlsRulesModel = new ActionControlsRules.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControlsPolicies model + ActionControlsPolicies actionControlsPoliciesModel = new ActionControlsPolicies.Builder() + .add(true) + .remove(true) + .build(); + + // Construct an instance of the ActionControls model + ActionControls actionControlsModel = new ActionControls.Builder() + .identities(actionControlsIdentitiesModel) + .rules(actionControlsRulesModel) + .policies(actionControlsPoliciesModel) + .build(); + + // Construct an instance of the UpdateProfileTemplateVersionOptions model + UpdateProfileTemplateVersionOptions updateProfileTemplateVersionOptionsModel = new UpdateProfileTemplateVersionOptions.Builder() + .ifMatch("testString") + .templateId("testString") + .version("testString") + .accountId("testString") + .name("testString") + .description("testString") + .profile(templateProfileComponentRequestModel) + .policyTemplateReferences(java.util.Arrays.asList(policyTemplateReferenceModel)) + .actionControls(actionControlsModel) + .build(); + + // Invoke updateProfileTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.updateProfileTemplateVersion(updateProfileTemplateVersionOptionsModel).execute(); + assertNotNull(response); + TrustedProfileTemplateResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateProfileTemplateVersionPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateProfileTemplateVersion operation with and without retries enabled + @Test + public void testUpdateProfileTemplateVersionWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testUpdateProfileTemplateVersionWOptions(); + + iamIdentityService.disableRetries(); + testUpdateProfileTemplateVersionWOptions(); + } + + // Test the updateProfileTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateProfileTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.updateProfileTemplateVersion(null).execute(); + } + + // Test the deleteProfileTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteProfileTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteProfileTemplateVersionPath = "/v1/profile_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteProfileTemplateVersionOptions model + DeleteProfileTemplateVersionOptions deleteProfileTemplateVersionOptionsModel = new DeleteProfileTemplateVersionOptions.Builder() + .templateId("testString") + .version("testString") + .build(); + + // Invoke deleteProfileTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.deleteProfileTemplateVersion(deleteProfileTemplateVersionOptionsModel).execute(); + assertNotNull(response); + Void responseObj = response.getResult(); + assertNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "DELETE"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, deleteProfileTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteProfileTemplateVersion operation with and without retries enabled + @Test + public void testDeleteProfileTemplateVersionWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testDeleteProfileTemplateVersionWOptions(); + + iamIdentityService.disableRetries(); + testDeleteProfileTemplateVersionWOptions(); + } + + // Test the deleteProfileTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteProfileTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.deleteProfileTemplateVersion(null).execute(); + } + + // Test the commitProfileTemplate operation with a valid options model parameter + @Test + public void testCommitProfileTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitProfileTemplatePath = "/v1/profile_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitProfileTemplateOptions model + CommitProfileTemplateOptions commitProfileTemplateOptionsModel = new CommitProfileTemplateOptions.Builder() + .templateId("testString") + .version("testString") + .build(); + + // Invoke commitProfileTemplate() with a valid options model and verify the result + Response response = iamIdentityService.commitProfileTemplate(commitProfileTemplateOptionsModel).execute(); + assertNotNull(response); + Void responseObj = response.getResult(); + assertNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, commitProfileTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitProfileTemplate operation with and without retries enabled + @Test + public void testCommitProfileTemplateWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testCommitProfileTemplateWOptions(); + + iamIdentityService.disableRetries(); + testCommitProfileTemplateWOptions(); + } + + // Test the commitProfileTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitProfileTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.commitProfileTemplate(null).execute(); } // Test the listTrustedProfileAssignments operation with a valid options model parameter @@ -4002,19 +4141,19 @@ public void testUpdateTrustedProfileAssignmentNoOptions() throws Throwable { iamIdentityService.updateTrustedProfileAssignment(null).execute(); } - // Test the listProfileTemplates operation with a valid options model parameter + // Test the listAccountSettingsTemplates operation with a valid options model parameter @Test - public void testListProfileTemplatesWOptions() throws Throwable { + public void testListAccountSettingsTemplatesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"profile_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listProfileTemplatesPath = "/v1/profile_templates"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"account_settings_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listAccountSettingsTemplatesPath = "/v1/account_settings_templates"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListProfileTemplatesOptions model - ListProfileTemplatesOptions listProfileTemplatesOptionsModel = new ListProfileTemplatesOptions.Builder() + // Construct an instance of the ListAccountSettingsTemplatesOptions model + ListAccountSettingsTemplatesOptions listAccountSettingsTemplatesOptionsModel = new ListAccountSettingsTemplatesOptions.Builder() .accountId("testString") .limit("20") .pagetoken("testString") @@ -4023,10 +4162,10 @@ public void testListProfileTemplatesWOptions() throws Throwable { .includeHistory("false") .build(); - // Invoke listProfileTemplates() with a valid options model and verify the result - Response response = iamIdentityService.listProfileTemplates(listProfileTemplatesOptionsModel).execute(); + // Invoke listAccountSettingsTemplates() with a valid options model and verify the result + Response response = iamIdentityService.listAccountSettingsTemplates(listAccountSettingsTemplatesOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateList responseObj = response.getResult(); + AccountSettingsTemplateList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -4035,7 +4174,7 @@ public void testListProfileTemplatesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProfileTemplatesPath); + assertEquals(parsedPath, listAccountSettingsTemplatesPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); @@ -4047,104 +4186,59 @@ public void testListProfileTemplatesWOptions() throws Throwable { assertEquals(query.get("include_history"), "false"); } - // Test the listProfileTemplates operation with and without retries enabled + // Test the listAccountSettingsTemplates operation with and without retries enabled @Test - public void testListProfileTemplatesWRetries() throws Throwable { + public void testListAccountSettingsTemplatesWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListProfileTemplatesWOptions(); + testListAccountSettingsTemplatesWOptions(); iamIdentityService.disableRetries(); - testListProfileTemplatesWOptions(); + testListAccountSettingsTemplatesWOptions(); } - // Test the createProfileTemplate operation with a valid options model parameter + // Test the createAccountSettingsTemplate operation with a valid options model parameter @Test - public void testCreateProfileTemplateWOptions() throws Throwable { + public void testCreateAccountSettingsTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String createProfileTemplatePath = "/v1/profile_templates"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String createAccountSettingsTemplatePath = "/v1/account_settings_templates"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the ProfileClaimRuleConditions model - ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() - .claim("testString") - .operator("testString") - .value("testString") - .build(); - - // Construct an instance of the TrustedProfileTemplateClaimRule model - TrustedProfileTemplateClaimRule trustedProfileTemplateClaimRuleModel = new TrustedProfileTemplateClaimRule.Builder() - .name("testString") - .type("Profile-SAML") - .realmName("testString") - .expiration(Long.valueOf("26")) - .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) - .build(); - - // Construct an instance of the ProfileIdentityRequest model - ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() - .identifier("testString") - .type("user") - .accounts(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Construct an instance of the TemplateProfileComponentRequest model - TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() - .name("testString") - .description("testString") - .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) - .identities(java.util.Arrays.asList(profileIdentityRequestModel)) - .build(); - - // Construct an instance of the PolicyTemplateReference model - PolicyTemplateReference policyTemplateReferenceModel = new PolicyTemplateReference.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the ActionControlsIdentities model - ActionControlsIdentities actionControlsIdentitiesModel = new ActionControlsIdentities.Builder() - .add(true) - .remove(true) - .build(); - - // Construct an instance of the ActionControlsRules model - ActionControlsRules actionControlsRulesModel = new ActionControlsRules.Builder() - .add(true) - .remove(true) - .build(); - - // Construct an instance of the ActionControlsPolicies model - ActionControlsPolicies actionControlsPoliciesModel = new ActionControlsPolicies.Builder() - .add(true) - .remove(true) + // Construct an instance of the AccountSettingsUserMFA model + AccountSettingsUserMFA accountSettingsUserMfaModel = new AccountSettingsUserMFA.Builder() + .iamId("testString") + .mfa("NONE") .build(); - // Construct an instance of the ActionControls model - ActionControls actionControlsModel = new ActionControls.Builder() - .identities(actionControlsIdentitiesModel) - .rules(actionControlsRulesModel) - .policies(actionControlsPoliciesModel) + // Construct an instance of the AccountSettingsComponent model + AccountSettingsComponent accountSettingsComponentModel = new AccountSettingsComponent.Builder() + .restrictCreateServiceId("NOT_SET") + .restrictCreatePlatformApikey("NOT_SET") + .allowedIpAddresses("testString") + .mfa("NONE") + .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) + .sessionExpirationInSeconds("86400") + .sessionInvalidationInSeconds("7200") + .maxSessionsPerIdentity("testString") + .systemAccessTokenExpirationInSeconds("3600") + .systemRefreshTokenExpirationInSeconds("259200") .build(); - // Construct an instance of the CreateProfileTemplateOptions model - CreateProfileTemplateOptions createProfileTemplateOptionsModel = new CreateProfileTemplateOptions.Builder() + // Construct an instance of the CreateAccountSettingsTemplateOptions model + CreateAccountSettingsTemplateOptions createAccountSettingsTemplateOptionsModel = new CreateAccountSettingsTemplateOptions.Builder() .accountId("testString") .name("testString") .description("testString") - .profile(templateProfileComponentRequestModel) - .policyTemplateReferences(java.util.Arrays.asList(policyTemplateReferenceModel)) - .actionControls(actionControlsModel) + .accountSettings(accountSettingsComponentModel) .build(); - // Invoke createProfileTemplate() with a valid options model and verify the result - Response response = iamIdentityService.createProfileTemplate(createProfileTemplateOptionsModel).execute(); + // Invoke createAccountSettingsTemplate() with a valid options model and verify the result + Response response = iamIdentityService.createAccountSettingsTemplate(createAccountSettingsTemplateOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateResponse responseObj = response.getResult(); + AccountSettingsTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -4153,43 +4247,43 @@ public void testCreateProfileTemplateWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createProfileTemplatePath); + assertEquals(parsedPath, createAccountSettingsTemplatePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createProfileTemplate operation with and without retries enabled + // Test the createAccountSettingsTemplate operation with and without retries enabled @Test - public void testCreateProfileTemplateWRetries() throws Throwable { + public void testCreateAccountSettingsTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateProfileTemplateWOptions(); + testCreateAccountSettingsTemplateWOptions(); iamIdentityService.disableRetries(); - testCreateProfileTemplateWOptions(); + testCreateAccountSettingsTemplateWOptions(); } - // Test the getLatestProfileTemplateVersion operation with a valid options model parameter + // Test the getLatestAccountSettingsTemplateVersion operation with a valid options model parameter @Test - public void testGetLatestProfileTemplateVersionWOptions() throws Throwable { + public void testGetLatestAccountSettingsTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getLatestProfileTemplateVersionPath = "/v1/profile_templates/testString"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getLatestAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetLatestProfileTemplateVersionOptions model - GetLatestProfileTemplateVersionOptions getLatestProfileTemplateVersionOptionsModel = new GetLatestProfileTemplateVersionOptions.Builder() + // Construct an instance of the GetLatestAccountSettingsTemplateVersionOptions model + GetLatestAccountSettingsTemplateVersionOptions getLatestAccountSettingsTemplateVersionOptionsModel = new GetLatestAccountSettingsTemplateVersionOptions.Builder() .templateId("testString") .includeHistory(false) .build(); - // Invoke getLatestProfileTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.getLatestProfileTemplateVersion(getLatestProfileTemplateVersionOptionsModel).execute(); + // Invoke getLatestAccountSettingsTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.getLatestAccountSettingsTemplateVersion(getLatestAccountSettingsTemplateVersionOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateResponse responseObj = response.getResult(); + AccountSettingsTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -4198,47 +4292,47 @@ public void testGetLatestProfileTemplateVersionWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getLatestProfileTemplateVersionPath); + assertEquals(parsedPath, getLatestAccountSettingsTemplateVersionPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); } - // Test the getLatestProfileTemplateVersion operation with and without retries enabled + // Test the getLatestAccountSettingsTemplateVersion operation with and without retries enabled @Test - public void testGetLatestProfileTemplateVersionWRetries() throws Throwable { + public void testGetLatestAccountSettingsTemplateVersionWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetLatestProfileTemplateVersionWOptions(); + testGetLatestAccountSettingsTemplateVersionWOptions(); iamIdentityService.disableRetries(); - testGetLatestProfileTemplateVersionWOptions(); + testGetLatestAccountSettingsTemplateVersionWOptions(); } - // Test the getLatestProfileTemplateVersion operation with a null options model (negative test) + // Test the getLatestAccountSettingsTemplateVersion operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetLatestProfileTemplateVersionNoOptions() throws Throwable { + public void testGetLatestAccountSettingsTemplateVersionNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getLatestProfileTemplateVersion(null).execute(); + iamIdentityService.getLatestAccountSettingsTemplateVersion(null).execute(); } - // Test the deleteAllVersionsOfProfileTemplate operation with a valid options model parameter + // Test the deleteAllVersionsOfAccountSettingsTemplate operation with a valid options model parameter @Test - public void testDeleteAllVersionsOfProfileTemplateWOptions() throws Throwable { + public void testDeleteAllVersionsOfAccountSettingsTemplateWOptions() throws Throwable { // Register a mock response String mockResponseBody = ""; - String deleteAllVersionsOfProfileTemplatePath = "/v1/profile_templates/testString"; + String deleteAllVersionsOfAccountSettingsTemplatePath = "/v1/account_settings_templates/testString"; server.enqueue(new MockResponse() .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the DeleteAllVersionsOfProfileTemplateOptions model - DeleteAllVersionsOfProfileTemplateOptions deleteAllVersionsOfProfileTemplateOptionsModel = new DeleteAllVersionsOfProfileTemplateOptions.Builder() + // Construct an instance of the DeleteAllVersionsOfAccountSettingsTemplateOptions model + DeleteAllVersionsOfAccountSettingsTemplateOptions deleteAllVersionsOfAccountSettingsTemplateOptionsModel = new DeleteAllVersionsOfAccountSettingsTemplateOptions.Builder() .templateId("testString") .build(); - // Invoke deleteAllVersionsOfProfileTemplate() with a valid options model and verify the result - Response response = iamIdentityService.deleteAllVersionsOfProfileTemplate(deleteAllVersionsOfProfileTemplateOptionsModel).execute(); + // Invoke deleteAllVersionsOfAccountSettingsTemplate() with a valid options model and verify the result + Response response = iamIdentityService.deleteAllVersionsOfAccountSettingsTemplate(deleteAllVersionsOfAccountSettingsTemplateOptionsModel).execute(); assertNotNull(response); Void responseObj = response.getResult(); assertNull(responseObj); @@ -4249,42 +4343,42 @@ public void testDeleteAllVersionsOfProfileTemplateWOptions() throws Throwable { assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteAllVersionsOfProfileTemplatePath); + assertEquals(parsedPath, deleteAllVersionsOfAccountSettingsTemplatePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteAllVersionsOfProfileTemplate operation with and without retries enabled + // Test the deleteAllVersionsOfAccountSettingsTemplate operation with and without retries enabled @Test - public void testDeleteAllVersionsOfProfileTemplateWRetries() throws Throwable { + public void testDeleteAllVersionsOfAccountSettingsTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteAllVersionsOfProfileTemplateWOptions(); + testDeleteAllVersionsOfAccountSettingsTemplateWOptions(); iamIdentityService.disableRetries(); - testDeleteAllVersionsOfProfileTemplateWOptions(); + testDeleteAllVersionsOfAccountSettingsTemplateWOptions(); } - // Test the deleteAllVersionsOfProfileTemplate operation with a null options model (negative test) + // Test the deleteAllVersionsOfAccountSettingsTemplate operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteAllVersionsOfProfileTemplateNoOptions() throws Throwable { + public void testDeleteAllVersionsOfAccountSettingsTemplateNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteAllVersionsOfProfileTemplate(null).execute(); + iamIdentityService.deleteAllVersionsOfAccountSettingsTemplate(null).execute(); } - // Test the listVersionsOfProfileTemplate operation with a valid options model parameter + // Test the listVersionsOfAccountSettingsTemplate operation with a valid options model parameter @Test - public void testListVersionsOfProfileTemplateWOptions() throws Throwable { + public void testListVersionsOfAccountSettingsTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"profile_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listVersionsOfProfileTemplatePath = "/v1/profile_templates/testString/versions"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 20, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"account_settings_templates\": [{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listVersionsOfAccountSettingsTemplatePath = "/v1/account_settings_templates/testString/versions"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListVersionsOfProfileTemplateOptions model - ListVersionsOfProfileTemplateOptions listVersionsOfProfileTemplateOptionsModel = new ListVersionsOfProfileTemplateOptions.Builder() + // Construct an instance of the ListVersionsOfAccountSettingsTemplateOptions model + ListVersionsOfAccountSettingsTemplateOptions listVersionsOfAccountSettingsTemplateOptionsModel = new ListVersionsOfAccountSettingsTemplateOptions.Builder() .templateId("testString") .limit("20") .pagetoken("testString") @@ -4293,10 +4387,10 @@ public void testListVersionsOfProfileTemplateWOptions() throws Throwable { .includeHistory("false") .build(); - // Invoke listVersionsOfProfileTemplate() with a valid options model and verify the result - Response response = iamIdentityService.listVersionsOfProfileTemplate(listVersionsOfProfileTemplateOptionsModel).execute(); + // Invoke listVersionsOfAccountSettingsTemplate() with a valid options model and verify the result + Response response = iamIdentityService.listVersionsOfAccountSettingsTemplate(listVersionsOfAccountSettingsTemplateOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateList responseObj = response.getResult(); + AccountSettingsTemplateList responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -4305,7 +4399,7 @@ public void testListVersionsOfProfileTemplateWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listVersionsOfProfileTemplatePath); + assertEquals(parsedPath, listVersionsOfAccountSettingsTemplatePath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); @@ -4316,342 +4410,524 @@ public void testListVersionsOfProfileTemplateWOptions() throws Throwable { assertEquals(query.get("include_history"), "false"); } - // Test the listVersionsOfProfileTemplate operation with and without retries enabled + // Test the listVersionsOfAccountSettingsTemplate operation with and without retries enabled @Test - public void testListVersionsOfProfileTemplateWRetries() throws Throwable { + public void testListVersionsOfAccountSettingsTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testListVersionsOfProfileTemplateWOptions(); + testListVersionsOfAccountSettingsTemplateWOptions(); iamIdentityService.disableRetries(); - testListVersionsOfProfileTemplateWOptions(); + testListVersionsOfAccountSettingsTemplateWOptions(); } - // Test the listVersionsOfProfileTemplate operation with a null options model (negative test) + // Test the listVersionsOfAccountSettingsTemplate operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListVersionsOfProfileTemplateNoOptions() throws Throwable { + public void testListVersionsOfAccountSettingsTemplateNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.listVersionsOfProfileTemplate(null).execute(); + iamIdentityService.listVersionsOfAccountSettingsTemplate(null).execute(); } - // Test the createProfileTemplateVersion operation with a valid options model parameter + // Test the createAccountSettingsTemplateVersion operation with a valid options model parameter @Test - public void testCreateProfileTemplateVersionWOptions() throws Throwable { + public void testCreateAccountSettingsTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String createProfileTemplateVersionPath = "/v1/profile_templates/testString/versions"; + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String createAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the ProfileClaimRuleConditions model - ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() - .claim("testString") - .operator("testString") - .value("testString") + // Construct an instance of the AccountSettingsUserMFA model + AccountSettingsUserMFA accountSettingsUserMfaModel = new AccountSettingsUserMFA.Builder() + .iamId("testString") + .mfa("NONE") .build(); - // Construct an instance of the TrustedProfileTemplateClaimRule model - TrustedProfileTemplateClaimRule trustedProfileTemplateClaimRuleModel = new TrustedProfileTemplateClaimRule.Builder() - .name("testString") - .type("Profile-SAML") - .realmName("testString") - .expiration(Long.valueOf("26")) - .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) + // Construct an instance of the AccountSettingsComponent model + AccountSettingsComponent accountSettingsComponentModel = new AccountSettingsComponent.Builder() + .restrictCreateServiceId("NOT_SET") + .restrictCreatePlatformApikey("NOT_SET") + .allowedIpAddresses("testString") + .mfa("NONE") + .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) + .sessionExpirationInSeconds("86400") + .sessionInvalidationInSeconds("7200") + .maxSessionsPerIdentity("testString") + .systemAccessTokenExpirationInSeconds("3600") + .systemRefreshTokenExpirationInSeconds("259200") .build(); - // Construct an instance of the ProfileIdentityRequest model - ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() - .identifier("testString") - .type("user") - .accounts(java.util.Arrays.asList("testString")) + // Construct an instance of the CreateAccountSettingsTemplateVersionOptions model + CreateAccountSettingsTemplateVersionOptions createAccountSettingsTemplateVersionOptionsModel = new CreateAccountSettingsTemplateVersionOptions.Builder() + .templateId("testString") + .accountId("testString") + .name("testString") .description("testString") + .accountSettings(accountSettingsComponentModel) .build(); - // Construct an instance of the TemplateProfileComponentRequest model - TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() - .name("testString") - .description("testString") - .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) - .identities(java.util.Arrays.asList(profileIdentityRequestModel)) - .build(); + // Invoke createAccountSettingsTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.createAccountSettingsTemplateVersion(createAccountSettingsTemplateVersionOptionsModel).execute(); + assertNotNull(response); + AccountSettingsTemplateResponse responseObj = response.getResult(); + assertNotNull(responseObj); - // Construct an instance of the PolicyTemplateReference model - PolicyTemplateReference policyTemplateReferenceModel = new PolicyTemplateReference.Builder() - .id("testString") + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createAccountSettingsTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createAccountSettingsTemplateVersion operation with and without retries enabled + @Test + public void testCreateAccountSettingsTemplateVersionWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testCreateAccountSettingsTemplateVersionWOptions(); + + iamIdentityService.disableRetries(); + testCreateAccountSettingsTemplateVersionWOptions(); + } + + // Test the createAccountSettingsTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccountSettingsTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.createAccountSettingsTemplateVersion(null).execute(); + } + + // Test the getAccountSettingsTemplateVersion operation with a valid options model parameter + @Test + public void testGetAccountSettingsTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetAccountSettingsTemplateVersionOptions model + GetAccountSettingsTemplateVersionOptions getAccountSettingsTemplateVersionOptionsModel = new GetAccountSettingsTemplateVersionOptions.Builder() + .templateId("testString") .version("testString") + .includeHistory(false) .build(); - // Construct an instance of the ActionControlsIdentities model - ActionControlsIdentities actionControlsIdentitiesModel = new ActionControlsIdentities.Builder() - .add(true) - .remove(true) - .build(); + // Invoke getAccountSettingsTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.getAccountSettingsTemplateVersion(getAccountSettingsTemplateVersionOptionsModel).execute(); + assertNotNull(response); + AccountSettingsTemplateResponse responseObj = response.getResult(); + assertNotNull(responseObj); - // Construct an instance of the ActionControlsRules model - ActionControlsRules actionControlsRulesModel = new ActionControlsRules.Builder() - .add(true) - .remove(true) - .build(); + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getAccountSettingsTemplateVersionPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + } - // Construct an instance of the ActionControlsPolicies model - ActionControlsPolicies actionControlsPoliciesModel = new ActionControlsPolicies.Builder() - .add(true) - .remove(true) + // Test the getAccountSettingsTemplateVersion operation with and without retries enabled + @Test + public void testGetAccountSettingsTemplateVersionWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testGetAccountSettingsTemplateVersionWOptions(); + + iamIdentityService.disableRetries(); + testGetAccountSettingsTemplateVersionWOptions(); + } + + // Test the getAccountSettingsTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccountSettingsTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.getAccountSettingsTemplateVersion(null).execute(); + } + + // Test the updateAccountSettingsTemplateVersion operation with a valid options model parameter + @Test + public void testUpdateAccountSettingsTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"account_settings\": {\"restrict_create_service_id\": \"NOT_SET\", \"restrict_create_platform_apikey\": \"NOT_SET\", \"allowed_ip_addresses\": \"allowedIpAddresses\", \"mfa\": \"NONE\", \"user_mfa\": [{\"iam_id\": \"iamId\", \"mfa\": \"NONE\"}], \"session_expiration_in_seconds\": \"86400\", \"session_invalidation_in_seconds\": \"7200\", \"max_sessions_per_identity\": \"maxSessionsPerIdentity\", \"system_access_token_expiration_in_seconds\": \"3600\", \"system_refresh_token_expiration_in_seconds\": \"259200\"}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String updateAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the AccountSettingsUserMFA model + AccountSettingsUserMFA accountSettingsUserMfaModel = new AccountSettingsUserMFA.Builder() + .iamId("testString") + .mfa("NONE") .build(); - // Construct an instance of the ActionControls model - ActionControls actionControlsModel = new ActionControls.Builder() - .identities(actionControlsIdentitiesModel) - .rules(actionControlsRulesModel) - .policies(actionControlsPoliciesModel) + // Construct an instance of the AccountSettingsComponent model + AccountSettingsComponent accountSettingsComponentModel = new AccountSettingsComponent.Builder() + .restrictCreateServiceId("NOT_SET") + .restrictCreatePlatformApikey("NOT_SET") + .allowedIpAddresses("testString") + .mfa("NONE") + .userMfa(java.util.Arrays.asList(accountSettingsUserMfaModel)) + .sessionExpirationInSeconds("86400") + .sessionInvalidationInSeconds("7200") + .maxSessionsPerIdentity("testString") + .systemAccessTokenExpirationInSeconds("3600") + .systemRefreshTokenExpirationInSeconds("259200") .build(); - // Construct an instance of the CreateProfileTemplateVersionOptions model - CreateProfileTemplateVersionOptions createProfileTemplateVersionOptionsModel = new CreateProfileTemplateVersionOptions.Builder() + // Construct an instance of the UpdateAccountSettingsTemplateVersionOptions model + UpdateAccountSettingsTemplateVersionOptions updateAccountSettingsTemplateVersionOptionsModel = new UpdateAccountSettingsTemplateVersionOptions.Builder() + .ifMatch("testString") .templateId("testString") + .version("testString") .accountId("testString") .name("testString") .description("testString") - .profile(templateProfileComponentRequestModel) - .policyTemplateReferences(java.util.Arrays.asList(policyTemplateReferenceModel)) - .actionControls(actionControlsModel) + .accountSettings(accountSettingsComponentModel) .build(); - // Invoke createProfileTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.createProfileTemplateVersion(createProfileTemplateVersionOptionsModel).execute(); + // Invoke updateAccountSettingsTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.updateAccountSettingsTemplateVersion(updateAccountSettingsTemplateVersionOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateResponse responseObj = response.getResult(); + AccountSettingsTemplateResponse responseObj = response.getResult(); assertNotNull(responseObj); + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateAccountSettingsTemplateVersionPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateAccountSettingsTemplateVersion operation with and without retries enabled + @Test + public void testUpdateAccountSettingsTemplateVersionWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testUpdateAccountSettingsTemplateVersionWOptions(); + + iamIdentityService.disableRetries(); + testUpdateAccountSettingsTemplateVersionWOptions(); + } + + // Test the updateAccountSettingsTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccountSettingsTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.updateAccountSettingsTemplateVersion(null).execute(); + } + + // Test the deleteAccountSettingsTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteAccountSettingsTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteAccountSettingsTemplateVersionPath = "/v1/account_settings_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteAccountSettingsTemplateVersionOptions model + DeleteAccountSettingsTemplateVersionOptions deleteAccountSettingsTemplateVersionOptionsModel = new DeleteAccountSettingsTemplateVersionOptions.Builder() + .templateId("testString") + .version("testString") + .build(); + + // Invoke deleteAccountSettingsTemplateVersion() with a valid options model and verify the result + Response response = iamIdentityService.deleteAccountSettingsTemplateVersion(deleteAccountSettingsTemplateVersionOptionsModel).execute(); + assertNotNull(response); + Void responseObj = response.getResult(); + assertNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "DELETE"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, deleteAccountSettingsTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteAccountSettingsTemplateVersion operation with and without retries enabled + @Test + public void testDeleteAccountSettingsTemplateVersionWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testDeleteAccountSettingsTemplateVersionWOptions(); + + iamIdentityService.disableRetries(); + testDeleteAccountSettingsTemplateVersionWOptions(); + } + + // Test the deleteAccountSettingsTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccountSettingsTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamIdentityService.deleteAccountSettingsTemplateVersion(null).execute(); + } + + // Test the commitAccountSettingsTemplate operation with a valid options model parameter + @Test + public void testCommitAccountSettingsTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitAccountSettingsTemplatePath = "/v1/account_settings_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitAccountSettingsTemplateOptions model + CommitAccountSettingsTemplateOptions commitAccountSettingsTemplateOptionsModel = new CommitAccountSettingsTemplateOptions.Builder() + .templateId("testString") + .version("testString") + .build(); + + // Invoke commitAccountSettingsTemplate() with a valid options model and verify the result + Response response = iamIdentityService.commitAccountSettingsTemplate(commitAccountSettingsTemplateOptionsModel).execute(); + assertNotNull(response); + Void responseObj = response.getResult(); + assertNull(responseObj); + // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createProfileTemplateVersionPath); + assertEquals(parsedPath, commitAccountSettingsTemplatePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createProfileTemplateVersion operation with and without retries enabled + // Test the commitAccountSettingsTemplate operation with and without retries enabled @Test - public void testCreateProfileTemplateVersionWRetries() throws Throwable { + public void testCommitAccountSettingsTemplateWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCreateProfileTemplateVersionWOptions(); + testCommitAccountSettingsTemplateWOptions(); iamIdentityService.disableRetries(); - testCreateProfileTemplateVersionWOptions(); + testCommitAccountSettingsTemplateWOptions(); } - // Test the createProfileTemplateVersion operation with a null options model (negative test) + // Test the commitAccountSettingsTemplate operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateProfileTemplateVersionNoOptions() throws Throwable { + public void testCommitAccountSettingsTemplateNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.createProfileTemplateVersion(null).execute(); + iamIdentityService.commitAccountSettingsTemplate(null).execute(); + } + + // Test the listAccountSettingsAssignments operation with a valid options model parameter + @Test + public void testListAccountSettingsAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"offset\": 6, \"limit\": 5, \"first\": \"first\", \"previous\": \"previous\", \"next\": \"next\", \"assignments\": [{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}]}"; + String listAccountSettingsAssignmentsPath = "/v1/account_settings_assignments/"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListAccountSettingsAssignmentsOptions model + ListAccountSettingsAssignmentsOptions listAccountSettingsAssignmentsOptionsModel = new ListAccountSettingsAssignmentsOptions.Builder() + .accountId("testString") + .templateId("testString") + .templateVersion("testString") + .target("testString") + .targetType("Account") + .limit(Long.valueOf("20")) + .pagetoken("testString") + .sort("created_at") + .order("asc") + .includeHistory(false) + .build(); + + // Invoke listAccountSettingsAssignments() with a valid options model and verify the result + Response response = iamIdentityService.listAccountSettingsAssignments(listAccountSettingsAssignmentsOptionsModel).execute(); + assertNotNull(response); + TemplateAssignmentListResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listAccountSettingsAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(query.get("target"), "testString"); + assertEquals(query.get("target_type"), "Account"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("20")); + assertEquals(query.get("pagetoken"), "testString"); + assertEquals(query.get("sort"), "created_at"); + assertEquals(query.get("order"), "asc"); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + } + + // Test the listAccountSettingsAssignments operation with and without retries enabled + @Test + public void testListAccountSettingsAssignmentsWRetries() throws Throwable { + iamIdentityService.enableRetries(4, 30); + testListAccountSettingsAssignmentsWOptions(); + + iamIdentityService.disableRetries(); + testListAccountSettingsAssignmentsWOptions(); } - // Test the getProfileTemplateVersion operation with a valid options model parameter + // Test the createAccountSettingsAssignment operation with a valid options model parameter @Test - public void testGetProfileTemplateVersionWOptions() throws Throwable { + public void testCreateAccountSettingsAssignmentWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getProfileTemplateVersionPath = "/v1/profile_templates/testString/versions/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}"; + String createAccountSettingsAssignmentPath = "/v1/account_settings_assignments/"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(202) .setBody(mockResponseBody)); - // Construct an instance of the GetProfileTemplateVersionOptions model - GetProfileTemplateVersionOptions getProfileTemplateVersionOptionsModel = new GetProfileTemplateVersionOptions.Builder() + // Construct an instance of the CreateAccountSettingsAssignmentOptions model + CreateAccountSettingsAssignmentOptions createAccountSettingsAssignmentOptionsModel = new CreateAccountSettingsAssignmentOptions.Builder() .templateId("testString") - .version("testString") - .includeHistory(false) + .templateVersion(Long.valueOf("1")) + .targetType("Account") + .target("testString") .build(); - // Invoke getProfileTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.getProfileTemplateVersion(getProfileTemplateVersionOptionsModel).execute(); + // Invoke createAccountSettingsAssignment() with a valid options model and verify the result + Response response = iamIdentityService.createAccountSettingsAssignment(createAccountSettingsAssignmentOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateResponse responseObj = response.getResult(); + TemplateAssignmentResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProfileTemplateVersionPath); - // Verify query params + assertEquals(parsedPath, createAccountSettingsAssignmentPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); + assertNull(query); } - // Test the getProfileTemplateVersion operation with and without retries enabled + // Test the createAccountSettingsAssignment operation with and without retries enabled @Test - public void testGetProfileTemplateVersionWRetries() throws Throwable { + public void testCreateAccountSettingsAssignmentWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testGetProfileTemplateVersionWOptions(); + testCreateAccountSettingsAssignmentWOptions(); iamIdentityService.disableRetries(); - testGetProfileTemplateVersionWOptions(); + testCreateAccountSettingsAssignmentWOptions(); } - // Test the getProfileTemplateVersion operation with a null options model (negative test) + // Test the createAccountSettingsAssignment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProfileTemplateVersionNoOptions() throws Throwable { + public void testCreateAccountSettingsAssignmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.getProfileTemplateVersion(null).execute(); + iamIdentityService.createAccountSettingsAssignment(null).execute(); } - // Test the updateProfileTemplateVersion operation with a valid options model parameter + // Test the getAccountSettingsAssignment operation with a valid options model parameter @Test - public void testUpdateProfileTemplateVersionWOptions() throws Throwable { + public void testGetAccountSettingsAssignmentWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"version\": 7, \"account_id\": \"accountId\", \"name\": \"name\", \"description\": \"description\", \"committed\": false, \"profile\": {\"name\": \"name\", \"description\": \"description\", \"rules\": [{\"name\": \"name\", \"type\": \"Profile-SAML\", \"realm_name\": \"realmName\", \"expiration\": 10, \"conditions\": [{\"claim\": \"claim\", \"operator\": \"operator\", \"value\": \"value\"}]}], \"identities\": [{\"iam_id\": \"iamId\", \"identifier\": \"identifier\", \"type\": \"user\", \"accounts\": [\"accounts\"], \"description\": \"description\"}]}, \"policy_template_references\": [{\"id\": \"id\", \"version\": \"version\"}], \"action_controls\": {\"identities\": {\"add\": false, \"remove\": true}, \"rules\": {\"add\": false, \"remove\": true}, \"policies\": {\"add\": false, \"remove\": true}}, \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"entity_tag\": \"entityTag\", \"crn\": \"crn\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String updateProfileTemplateVersionPath = "/v1/profile_templates/testString/versions/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}"; + String getAccountSettingsAssignmentPath = "/v1/account_settings_assignments/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ProfileClaimRuleConditions model - ProfileClaimRuleConditions profileClaimRuleConditionsModel = new ProfileClaimRuleConditions.Builder() - .claim("testString") - .operator("testString") - .value("testString") - .build(); - - // Construct an instance of the TrustedProfileTemplateClaimRule model - TrustedProfileTemplateClaimRule trustedProfileTemplateClaimRuleModel = new TrustedProfileTemplateClaimRule.Builder() - .name("testString") - .type("Profile-SAML") - .realmName("testString") - .expiration(Long.valueOf("26")) - .conditions(java.util.Arrays.asList(profileClaimRuleConditionsModel)) - .build(); - - // Construct an instance of the ProfileIdentityRequest model - ProfileIdentityRequest profileIdentityRequestModel = new ProfileIdentityRequest.Builder() - .identifier("testString") - .type("user") - .accounts(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Construct an instance of the TemplateProfileComponentRequest model - TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() - .name("testString") - .description("testString") - .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) - .identities(java.util.Arrays.asList(profileIdentityRequestModel)) - .build(); - - // Construct an instance of the PolicyTemplateReference model - PolicyTemplateReference policyTemplateReferenceModel = new PolicyTemplateReference.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the ActionControlsIdentities model - ActionControlsIdentities actionControlsIdentitiesModel = new ActionControlsIdentities.Builder() - .add(true) - .remove(true) - .build(); - - // Construct an instance of the ActionControlsRules model - ActionControlsRules actionControlsRulesModel = new ActionControlsRules.Builder() - .add(true) - .remove(true) - .build(); - - // Construct an instance of the ActionControlsPolicies model - ActionControlsPolicies actionControlsPoliciesModel = new ActionControlsPolicies.Builder() - .add(true) - .remove(true) - .build(); - - // Construct an instance of the ActionControls model - ActionControls actionControlsModel = new ActionControls.Builder() - .identities(actionControlsIdentitiesModel) - .rules(actionControlsRulesModel) - .policies(actionControlsPoliciesModel) - .build(); - - // Construct an instance of the UpdateProfileTemplateVersionOptions model - UpdateProfileTemplateVersionOptions updateProfileTemplateVersionOptionsModel = new UpdateProfileTemplateVersionOptions.Builder() - .ifMatch("testString") - .templateId("testString") - .version("testString") - .accountId("testString") - .name("testString") - .description("testString") - .profile(templateProfileComponentRequestModel) - .policyTemplateReferences(java.util.Arrays.asList(policyTemplateReferenceModel)) - .actionControls(actionControlsModel) + // Construct an instance of the GetAccountSettingsAssignmentOptions model + GetAccountSettingsAssignmentOptions getAccountSettingsAssignmentOptionsModel = new GetAccountSettingsAssignmentOptions.Builder() + .assignmentId("testString") + .includeHistory(false) .build(); - // Invoke updateProfileTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.updateProfileTemplateVersion(updateProfileTemplateVersionOptionsModel).execute(); + // Invoke getAccountSettingsAssignment() with a valid options model and verify the result + Response response = iamIdentityService.getAccountSettingsAssignment(getAccountSettingsAssignmentOptionsModel).execute(); assertNotNull(response); - TrustedProfileTemplateResponse responseObj = response.getResult(); + TemplateAssignmentResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateProfileTemplateVersionPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify that there is no query string + assertEquals(parsedPath, getAccountSettingsAssignmentPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(Boolean.valueOf(query.get("include_history")), Boolean.valueOf(false)); } - // Test the updateProfileTemplateVersion operation with and without retries enabled + // Test the getAccountSettingsAssignment operation with and without retries enabled @Test - public void testUpdateProfileTemplateVersionWRetries() throws Throwable { + public void testGetAccountSettingsAssignmentWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testUpdateProfileTemplateVersionWOptions(); + testGetAccountSettingsAssignmentWOptions(); iamIdentityService.disableRetries(); - testUpdateProfileTemplateVersionWOptions(); + testGetAccountSettingsAssignmentWOptions(); } - // Test the updateProfileTemplateVersion operation with a null options model (negative test) + // Test the getAccountSettingsAssignment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateProfileTemplateVersionNoOptions() throws Throwable { + public void testGetAccountSettingsAssignmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.updateProfileTemplateVersion(null).execute(); + iamIdentityService.getAccountSettingsAssignment(null).execute(); } - // Test the deleteProfileTemplateVersion operation with a valid options model parameter + // Test the deleteAccountSettingsAssignment operation with a valid options model parameter @Test - public void testDeleteProfileTemplateVersionWOptions() throws Throwable { + public void testDeleteAccountSettingsAssignmentWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteProfileTemplateVersionPath = "/v1/profile_templates/testString/versions/testString"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"status_code\": \"statusCode\", \"errors\": [{\"code\": \"code\", \"message_code\": \"messageCode\", \"message\": \"message\", \"details\": \"details\"}], \"trace\": \"trace\"}"; + String deleteAccountSettingsAssignmentPath = "/v1/account_settings_assignments/testString"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(202) .setBody(mockResponseBody)); - // Construct an instance of the DeleteProfileTemplateVersionOptions model - DeleteProfileTemplateVersionOptions deleteProfileTemplateVersionOptionsModel = new DeleteProfileTemplateVersionOptions.Builder() - .templateId("testString") - .version("testString") + // Construct an instance of the DeleteAccountSettingsAssignmentOptions model + DeleteAccountSettingsAssignmentOptions deleteAccountSettingsAssignmentOptionsModel = new DeleteAccountSettingsAssignmentOptions.Builder() + .assignmentId("testString") .build(); - // Invoke deleteProfileTemplateVersion() with a valid options model and verify the result - Response response = iamIdentityService.deleteProfileTemplateVersion(deleteProfileTemplateVersionOptionsModel).execute(); + // Invoke deleteAccountSettingsAssignment() with a valid options model and verify the result + Response response = iamIdentityService.deleteAccountSettingsAssignment(deleteAccountSettingsAssignmentOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + ExceptionResponse responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); @@ -4659,78 +4935,82 @@ public void testDeleteProfileTemplateVersionWOptions() throws Throwable { assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteProfileTemplateVersionPath); + assertEquals(parsedPath, deleteAccountSettingsAssignmentPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteProfileTemplateVersion operation with and without retries enabled + // Test the deleteAccountSettingsAssignment operation with and without retries enabled @Test - public void testDeleteProfileTemplateVersionWRetries() throws Throwable { + public void testDeleteAccountSettingsAssignmentWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testDeleteProfileTemplateVersionWOptions(); + testDeleteAccountSettingsAssignmentWOptions(); iamIdentityService.disableRetries(); - testDeleteProfileTemplateVersionWOptions(); + testDeleteAccountSettingsAssignmentWOptions(); } - // Test the deleteProfileTemplateVersion operation with a null options model (negative test) + // Test the deleteAccountSettingsAssignment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteProfileTemplateVersionNoOptions() throws Throwable { + public void testDeleteAccountSettingsAssignmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.deleteProfileTemplateVersion(null).execute(); + iamIdentityService.deleteAccountSettingsAssignment(null).execute(); } - // Test the commitProfileTemplate operation with a valid options model parameter + // Test the updateAccountSettingsAssignment operation with a valid options model parameter @Test - public void testCommitProfileTemplateWOptions() throws Throwable { + public void testUpdateAccountSettingsAssignmentWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String commitProfileTemplatePath = "/v1/profile_templates/testString/versions/testString/commit"; + String mockResponseBody = "{\"context\": {\"transaction_id\": \"transactionId\", \"operation\": \"operation\", \"user_agent\": \"userAgent\", \"url\": \"url\", \"instance_id\": \"instanceId\", \"thread_id\": \"threadId\", \"host\": \"host\", \"start_time\": \"startTime\", \"end_time\": \"endTime\", \"elapsed_time\": \"elapsedTime\", \"cluster_name\": \"clusterName\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"template_id\": \"templateId\", \"template_version\": 15, \"target_type\": \"targetType\", \"target\": \"target\", \"status\": \"status\", \"resources\": [{\"target\": \"target\", \"profile\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"account_settings\": {\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}, \"policy_template_refs\": [{\"id\": \"id\", \"version\": \"version\", \"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"statusCode\": \"statusCode\"}, \"status\": \"status\"}]}], \"history\": [{\"timestamp\": \"timestamp\", \"iam_id\": \"iamId\", \"iam_id_account\": \"iamIdAccount\", \"action\": \"action\", \"params\": [\"params\"], \"message\": \"message\"}], \"href\": \"href\", \"created_at\": \"createdAt\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"lastModifiedAt\", \"last_modified_by_id\": \"lastModifiedById\", \"entity_tag\": \"entityTag\"}"; + String updateAccountSettingsAssignmentPath = "/v1/account_settings_assignments/testString"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the CommitProfileTemplateOptions model - CommitProfileTemplateOptions commitProfileTemplateOptionsModel = new CommitProfileTemplateOptions.Builder() - .templateId("testString") - .version("testString") + // Construct an instance of the UpdateAccountSettingsAssignmentOptions model + UpdateAccountSettingsAssignmentOptions updateAccountSettingsAssignmentOptionsModel = new UpdateAccountSettingsAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion(Long.valueOf("1")) .build(); - // Invoke commitProfileTemplate() with a valid options model and verify the result - Response response = iamIdentityService.commitProfileTemplate(commitProfileTemplateOptionsModel).execute(); + // Invoke updateAccountSettingsAssignment() with a valid options model and verify the result + Response response = iamIdentityService.updateAccountSettingsAssignment(updateAccountSettingsAssignmentOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + TemplateAssignmentResponse responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "PATCH"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, commitProfileTemplatePath); + assertEquals(parsedPath, updateAccountSettingsAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the commitProfileTemplate operation with and without retries enabled + // Test the updateAccountSettingsAssignment operation with and without retries enabled @Test - public void testCommitProfileTemplateWRetries() throws Throwable { + public void testUpdateAccountSettingsAssignmentWRetries() throws Throwable { iamIdentityService.enableRetries(4, 30); - testCommitProfileTemplateWOptions(); + testUpdateAccountSettingsAssignmentWOptions(); iamIdentityService.disableRetries(); - testCommitProfileTemplateWOptions(); + testUpdateAccountSettingsAssignmentWOptions(); } - // Test the commitProfileTemplate operation with a null options model (negative test) + // Test the updateAccountSettingsAssignment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitProfileTemplateNoOptions() throws Throwable { + public void testUpdateAccountSettingsAssignmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - iamIdentityService.commitProfileTemplate(null).execute(); + iamIdentityService.updateAccountSettingsAssignment(null).execute(); } // Perform setup needed before each test method diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptionsTest.java index 33c8483b9b..2e2bfaa3ef 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileOptionsTest.java @@ -35,10 +35,12 @@ public void testCreateProfileOptions() throws Throwable { .name("testString") .accountId("testString") .description("testString") + .email("testString") .build(); assertEquals(createProfileOptionsModel.name(), "testString"); assertEquals(createProfileOptionsModel.accountId(), "testString"); assertEquals(createProfileOptionsModel.description(), "testString"); + assertEquals(createProfileOptionsModel.email(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateOptionsTest.java index 34174c3fd7..df98314346 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateOptionsTest.java @@ -76,11 +76,13 @@ public void testCreateProfileTemplateOptions() throws Throwable { TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() .name("testString") .description("testString") + .email("testString") .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) .identities(java.util.Arrays.asList(profileIdentityRequestModel)) .build(); assertEquals(templateProfileComponentRequestModel.name(), "testString"); assertEquals(templateProfileComponentRequestModel.description(), "testString"); + assertEquals(templateProfileComponentRequestModel.email(), "testString"); assertEquals(templateProfileComponentRequestModel.rules(), java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)); assertEquals(templateProfileComponentRequestModel.identities(), java.util.Arrays.asList(profileIdentityRequestModel)); diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateVersionOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateVersionOptionsTest.java index b80c60909e..0657fb6f99 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateVersionOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateProfileTemplateVersionOptionsTest.java @@ -76,11 +76,13 @@ public void testCreateProfileTemplateVersionOptions() throws Throwable { TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() .name("testString") .description("testString") + .email("testString") .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) .identities(java.util.Arrays.asList(profileIdentityRequestModel)) .build(); assertEquals(templateProfileComponentRequestModel.name(), "testString"); assertEquals(templateProfileComponentRequestModel.description(), "testString"); + assertEquals(templateProfileComponentRequestModel.email(), "testString"); assertEquals(templateProfileComponentRequestModel.rules(), java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)); assertEquals(templateProfileComponentRequestModel.identities(), java.util.Arrays.asList(profileIdentityRequestModel)); diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdGroupOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdGroupOptionsTest.java new file mode 100644 index 0000000000..d378181f75 --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdGroupOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.CreateServiceIdGroupOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateServiceIdGroupOptions model. + */ +public class CreateServiceIdGroupOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateServiceIdGroupOptions() throws Throwable { + CreateServiceIdGroupOptions createServiceIdGroupOptionsModel = new CreateServiceIdGroupOptions.Builder() + .accountId("testString") + .name("testString") + .description("testString") + .build(); + assertEquals(createServiceIdGroupOptionsModel.accountId(), "testString"); + assertEquals(createServiceIdGroupOptionsModel.name(), "testString"); + assertEquals(createServiceIdGroupOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateServiceIdGroupOptionsError() throws Throwable { + new CreateServiceIdGroupOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptionsTest.java index f679e35904..6986351d63 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/CreateServiceIdOptionsTest.java @@ -46,16 +46,20 @@ public void testCreateServiceIdOptions() throws Throwable { CreateServiceIdOptions createServiceIdOptionsModel = new CreateServiceIdOptions.Builder() .accountId("testString") .name("testString") + .groupId("testString") .description("testString") .uniqueInstanceCrns(java.util.Arrays.asList("testString")) .apikey(apiKeyInsideCreateServiceIdRequestModel) + .showGroupId("testString") .entityLock("false") .build(); assertEquals(createServiceIdOptionsModel.accountId(), "testString"); assertEquals(createServiceIdOptionsModel.name(), "testString"); + assertEquals(createServiceIdOptionsModel.groupId(), "testString"); assertEquals(createServiceIdOptionsModel.description(), "testString"); assertEquals(createServiceIdOptionsModel.uniqueInstanceCrns(), java.util.Arrays.asList("testString")); assertEquals(createServiceIdOptionsModel.apikey(), apiKeyInsideCreateServiceIdRequestModel); + assertEquals(createServiceIdOptionsModel.showGroupId(), "testString"); assertEquals(createServiceIdOptionsModel.entityLock(), "false"); } diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/DeleteServiceIdGroupOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/DeleteServiceIdGroupOptionsTest.java new file mode 100644 index 0000000000..ec35db527a --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/DeleteServiceIdGroupOptionsTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteServiceIdGroupOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteServiceIdGroupOptions model. + */ +public class DeleteServiceIdGroupOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteServiceIdGroupOptions() throws Throwable { + DeleteServiceIdGroupOptions deleteServiceIdGroupOptionsModel = new DeleteServiceIdGroupOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteServiceIdGroupOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteServiceIdGroupOptionsError() throws Throwable { + new DeleteServiceIdGroupOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdGroupOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdGroupOptionsTest.java new file mode 100644 index 0000000000..894d232c68 --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdGroupOptionsTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.GetServiceIdGroupOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetServiceIdGroupOptions model. + */ +public class GetServiceIdGroupOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetServiceIdGroupOptions() throws Throwable { + GetServiceIdGroupOptions getServiceIdGroupOptionsModel = new GetServiceIdGroupOptions.Builder() + .id("testString") + .build(); + assertEquals(getServiceIdGroupOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetServiceIdGroupOptionsError() throws Throwable { + new GetServiceIdGroupOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptionsTest.java index fc4b6c7dac..064861d750 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/GetServiceIdOptionsTest.java @@ -35,10 +35,12 @@ public void testGetServiceIdOptions() throws Throwable { .id("testString") .includeHistory(false) .includeActivity(false) + .showGroupId("testString") .build(); assertEquals(getServiceIdOptionsModel.id(), "testString"); assertEquals(getServiceIdOptionsModel.includeHistory(), Boolean.valueOf(false)); assertEquals(getServiceIdOptionsModel.includeActivity(), Boolean.valueOf(false)); + assertEquals(getServiceIdOptionsModel.showGroupId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/IdentityPreferencesResponseTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/IdentityPreferencesResponseTest.java new file mode 100644 index 0000000000..6046512d96 --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/IdentityPreferencesResponseTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.IdentityPreferenceResponse; +import com.ibm.cloud.platform_services.iam_identity.v1.model.IdentityPreferencesResponse; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IdentityPreferencesResponse model. + */ +public class IdentityPreferencesResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityPreferencesResponse() throws Throwable { + IdentityPreferencesResponse identityPreferencesResponseModel = new IdentityPreferencesResponse(); + assertNull(identityPreferencesResponseModel.getPreferences()); + } +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptionsTest.java index d278b8e898..c2328ff7d7 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListApiKeysOptionsTest.java @@ -42,6 +42,7 @@ public void testListApiKeysOptions() throws Throwable { .order("asc") .includeHistory(false) .filter("testString") + .groupId("testString") .build(); assertEquals(listApiKeysOptionsModel.accountId(), "testString"); assertEquals(listApiKeysOptionsModel.iamId(), "testString"); @@ -53,5 +54,6 @@ public void testListApiKeysOptions() throws Throwable { assertEquals(listApiKeysOptionsModel.order(), "asc"); assertEquals(listApiKeysOptionsModel.includeHistory(), Boolean.valueOf(false)); assertEquals(listApiKeysOptionsModel.filter(), "testString"); + assertEquals(listApiKeysOptionsModel.groupId(), "testString"); } } \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdGroupOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdGroupOptionsTest.java new file mode 100644 index 0000000000..d77b71aef2 --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdGroupOptionsTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.ListServiceIdGroupOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListServiceIdGroupOptions model. + */ +public class ListServiceIdGroupOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListServiceIdGroupOptions() throws Throwable { + ListServiceIdGroupOptions listServiceIdGroupOptionsModel = new ListServiceIdGroupOptions.Builder() + .accountId("testString") + .build(); + assertEquals(listServiceIdGroupOptionsModel.accountId(), "testString"); + } +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptionsTest.java index 9b82af74e9..c69362fec0 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ListServiceIdsOptionsTest.java @@ -33,6 +33,7 @@ public class ListServiceIdsOptionsTest { public void testListServiceIdsOptions() throws Throwable { ListServiceIdsOptions listServiceIdsOptionsModel = new ListServiceIdsOptions.Builder() .accountId("testString") + .groupId("testString") .name("testString") .pagesize(Long.valueOf("26")) .pagetoken("testString") @@ -40,8 +41,10 @@ public void testListServiceIdsOptions() throws Throwable { .order("asc") .includeHistory(false) .filter("testString") + .showGroupId("testString") .build(); assertEquals(listServiceIdsOptionsModel.accountId(), "testString"); + assertEquals(listServiceIdsOptionsModel.groupId(), "testString"); assertEquals(listServiceIdsOptionsModel.name(), "testString"); assertEquals(listServiceIdsOptionsModel.pagesize(), Long.valueOf("26")); assertEquals(listServiceIdsOptionsModel.pagetoken(), "testString"); @@ -49,5 +52,6 @@ public void testListServiceIdsOptions() throws Throwable { assertEquals(listServiceIdsOptionsModel.order(), "asc"); assertEquals(listServiceIdsOptionsModel.includeHistory(), Boolean.valueOf(false)); assertEquals(listServiceIdsOptionsModel.filter(), "testString"); + assertEquals(listServiceIdsOptionsModel.showGroupId(), "testString"); } } \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupListTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupListTest.java new file mode 100644 index 0000000000..5df5a641db --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupListTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroup; +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroupList; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ServiceIdGroupList model. + */ +public class ServiceIdGroupListTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testServiceIdGroupList() throws Throwable { + ServiceIdGroupList serviceIdGroupListModel = new ServiceIdGroupList(); + assertNull(serviceIdGroupListModel.getServiceidGroups()); + } +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupTest.java new file mode 100644 index 0000000000..6bbb278f9a --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdGroupTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.ServiceIdGroup; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ServiceIdGroup model. + */ +public class ServiceIdGroupTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testServiceIdGroup() throws Throwable { + ServiceIdGroup serviceIdGroupModel = new ServiceIdGroup(); + assertNull(serviceIdGroupModel.getId()); + assertNull(serviceIdGroupModel.getEntityTag()); + assertNull(serviceIdGroupModel.getAccountId()); + assertNull(serviceIdGroupModel.getCrn()); + assertNull(serviceIdGroupModel.getName()); + assertNull(serviceIdGroupModel.getDescription()); + assertNull(serviceIdGroupModel.getCreatedAt()); + assertNull(serviceIdGroupModel.getCreatedBy()); + assertNull(serviceIdGroupModel.getModifiedAt()); + } +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdTest.java index 0d8d5bfbf0..17541302d9 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/ServiceIdTest.java @@ -46,6 +46,7 @@ public void testServiceId() throws Throwable { assertNull(serviceIdModel.getCreatedAt()); assertNull(serviceIdModel.getModifiedAt()); assertNull(serviceIdModel.getAccountId()); + assertNull(serviceIdModel.getGroupId()); assertNull(serviceIdModel.getName()); assertNull(serviceIdModel.getDescription()); assertNull(serviceIdModel.getUniqueInstanceCrns()); diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequestTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequestTest.java index 18773112db..88d2badf74 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequestTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentRequestTest.java @@ -70,11 +70,13 @@ public void testTemplateProfileComponentRequest() throws Throwable { TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() .name("testString") .description("testString") + .email("testString") .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) .identities(java.util.Arrays.asList(profileIdentityRequestModel)) .build(); assertEquals(templateProfileComponentRequestModel.name(), "testString"); assertEquals(templateProfileComponentRequestModel.description(), "testString"); + assertEquals(templateProfileComponentRequestModel.email(), "testString"); assertEquals(templateProfileComponentRequestModel.rules(), java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)); assertEquals(templateProfileComponentRequestModel.identities(), java.util.Arrays.asList(profileIdentityRequestModel)); @@ -84,6 +86,7 @@ public void testTemplateProfileComponentRequest() throws Throwable { assertTrue(templateProfileComponentRequestModelNew instanceof TemplateProfileComponentRequest); assertEquals(templateProfileComponentRequestModelNew.name(), "testString"); assertEquals(templateProfileComponentRequestModelNew.description(), "testString"); + assertEquals(templateProfileComponentRequestModelNew.email(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponseTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponseTest.java index 66cd7fe775..b26d26785e 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponseTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TemplateProfileComponentResponseTest.java @@ -38,6 +38,7 @@ public void testTemplateProfileComponentResponse() throws Throwable { assertNull(templateProfileComponentResponseModel.getName()); assertNull(templateProfileComponentResponseModel.getDescription()); assertNull(templateProfileComponentResponseModel.getRules()); + assertNull(templateProfileComponentResponseModel.getEmail()); assertNull(templateProfileComponentResponseModel.getIdentities()); } } \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfileTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfileTest.java index eb9d49f89a..f5888c923c 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfileTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/TrustedProfileTest.java @@ -41,6 +41,7 @@ public void testTrustedProfile() throws Throwable { assertNull(trustedProfileModel.getCrn()); assertNull(trustedProfileModel.getName()); assertNull(trustedProfileModel.getDescription()); + assertNull(trustedProfileModel.getEmail()); assertNull(trustedProfileModel.getCreatedAt()); assertNull(trustedProfileModel.getModifiedAt()); assertNull(trustedProfileModel.getIamId()); diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptionsTest.java index f8dcd317f9..965dce552a 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileOptionsTest.java @@ -36,11 +36,13 @@ public void testUpdateProfileOptions() throws Throwable { .ifMatch("testString") .name("testString") .description("testString") + .email("testString") .build(); assertEquals(updateProfileOptionsModel.profileId(), "testString"); assertEquals(updateProfileOptionsModel.ifMatch(), "testString"); assertEquals(updateProfileOptionsModel.name(), "testString"); assertEquals(updateProfileOptionsModel.description(), "testString"); + assertEquals(updateProfileOptionsModel.email(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileTemplateVersionOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileTemplateVersionOptionsTest.java index 28f9ffcd10..6f73713509 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileTemplateVersionOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateProfileTemplateVersionOptionsTest.java @@ -76,11 +76,13 @@ public void testUpdateProfileTemplateVersionOptions() throws Throwable { TemplateProfileComponentRequest templateProfileComponentRequestModel = new TemplateProfileComponentRequest.Builder() .name("testString") .description("testString") + .email("testString") .rules(java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)) .identities(java.util.Arrays.asList(profileIdentityRequestModel)) .build(); assertEquals(templateProfileComponentRequestModel.name(), "testString"); assertEquals(templateProfileComponentRequestModel.description(), "testString"); + assertEquals(templateProfileComponentRequestModel.email(), "testString"); assertEquals(templateProfileComponentRequestModel.rules(), java.util.Arrays.asList(trustedProfileTemplateClaimRuleModel)); assertEquals(templateProfileComponentRequestModel.identities(), java.util.Arrays.asList(profileIdentityRequestModel)); diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdGroupOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdGroupOptionsTest.java new file mode 100644 index 0000000000..49eee89683 --- /dev/null +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdGroupOptionsTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.platform_services.iam_identity.v1.model; + +import com.ibm.cloud.platform_services.iam_identity.v1.model.UpdateServiceIdGroupOptions; +import com.ibm.cloud.platform_services.iam_identity.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateServiceIdGroupOptions model. + */ +public class UpdateServiceIdGroupOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateServiceIdGroupOptions() throws Throwable { + UpdateServiceIdGroupOptions updateServiceIdGroupOptionsModel = new UpdateServiceIdGroupOptions.Builder() + .id("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .build(); + assertEquals(updateServiceIdGroupOptionsModel.id(), "testString"); + assertEquals(updateServiceIdGroupOptionsModel.ifMatch(), "testString"); + assertEquals(updateServiceIdGroupOptionsModel.name(), "testString"); + assertEquals(updateServiceIdGroupOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateServiceIdGroupOptionsError() throws Throwable { + new UpdateServiceIdGroupOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptionsTest.java b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptionsTest.java index 72e9b1c26a..866272a944 100644 --- a/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptionsTest.java +++ b/modules/iam-identity/src/test/java/com/ibm/cloud/platform_services/iam_identity/v1/model/UpdateServiceIdOptionsTest.java @@ -37,12 +37,14 @@ public void testUpdateServiceIdOptions() throws Throwable { .name("testString") .description("testString") .uniqueInstanceCrns(java.util.Arrays.asList("testString")) + .showGroupId("testString") .build(); assertEquals(updateServiceIdOptionsModel.id(), "testString"); assertEquals(updateServiceIdOptionsModel.ifMatch(), "testString"); assertEquals(updateServiceIdOptionsModel.name(), "testString"); assertEquals(updateServiceIdOptionsModel.description(), "testString"); assertEquals(updateServiceIdOptionsModel.uniqueInstanceCrns(), java.util.Arrays.asList("testString")); + assertEquals(updateServiceIdOptionsModel.showGroupId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class)